I want to create a custom provider for Faker in Laravel (e.g. one for a random building name).
Where do I store the custom provider in my application and how do I use i
I found this worked better, as it did not require my $faker
instance to be instantiated with resolve()
:
public function register ()
{
$this->app->bind( Generator::class, function ( $app ) {
$faker = \Faker\Factory::create();
$faker->addProvider( new CustomFakerProvider( $faker ) );
return $faker;
} );
}