Is there a way to specify the Faker locale in the database/factories/ModelFactory.php file ? Here is my non functioning attempt at doing so >,<
JavaScript
x
$factory->define(AppFlyer::class, function (FakerGenerator $faker) {
// What is the correct way of doing this?
$faker->locale('en_GB');
return [
'zip' => $faker->postcode,
'state' => $faker->state,
];
});
Thanks for reading!
Advertisement
Answer
Faker locale can be configured in the config/app.php
configuration file. Just add the key faker_locale
.
e.g.: 'faker_locale' => 'fr_FR',
See also my PR to document that previously undocumented feature: https://github.com/laravel/laravel/pull/4161