Skip to content

Instantly share code, notes, and snippets.

View majebry's full-sized avatar

Hani Majebry majebry

View GitHub Profile
<?php
use SplStack;
class Dijkstra
{
/**
* Holds Stops in a graph structure
*
* @var array
<?php
namespace Tests\Unit;
use App\Admin;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;
class AdminTest extends TestCase
@majebry
majebry / GenderizedValidator.php
Last active September 26, 2018 11:18
For some languages, messages need to be formatted differently based on the attribute word gender (masculine or feminine. And this is an extension for the default Laravel Validator to help you define the gender of the attribute words, so your messages will look more smarter.
// Here we're just overriding the "getMessage()" function from Laravel 5.6 to accept translation choices.
<?php
namespace App\Services;
use Illuminate\Validation\Validator;
use Illuminate\Support\Str;
class GenderizedValidator extends Validator {
protected function getMessage($attribute, $rule)