Skip to content

Commit

Permalink
Use correct locale when resolving Faker from the container (#31615)
Browse files Browse the repository at this point in the history
  • Loading branch information
AegirLeet committed Feb 27, 2020
1 parent 2c394c1 commit 7d53415
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Illuminate/Database/DatabaseServiceProvider.php
Expand Up @@ -74,8 +74,8 @@ protected function registerConnectionServices()
*/
protected function registerEloquentFactory()
{
$this->app->singleton(FakerGenerator::class, function ($app) {
return FakerFactory::create($app['config']->get('app.faker_locale', 'en_US'));
$this->app->singleton(FakerGenerator::class, function ($app, $parameters) {
return FakerFactory::create($parameters['locale'] ?? $app['config']->get('app.faker_locale', 'en_US'));
});

$this->app->singleton(EloquentFactory::class, function ($app) {
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Testing/WithFaker.php
Expand Up @@ -46,7 +46,7 @@ protected function makeFaker($locale = null)
$locale = $locale ?? config('app.faker_locale', Factory::DEFAULT_LOCALE);

if (isset($this->app) && $this->app->bound(Generator::class)) {
return $this->app->make(Generator::class, [$locale]);
return $this->app->make(Generator::class, ['locale' => $locale]);
}

return Factory::create($locale);
Expand Down

0 comments on commit 7d53415

Please sign in to comment.