Open Legion112 opened 4 years ago
Here code of a trade that create a faker.
/** * Create a Faker instance for the given locale. * * @param string|null $locale * @return \Faker\Generator */ protected function makeFaker($locale = null) { return Factory::create($locale ?? config('app.faker_locale', Factory::DEFAULT_LOCALE)); }
https://github.com/laravel/framework/blob/afcfcf27299f1cd3a5146ab6930f363bee453156/src/Illuminate/Foundation/Testing/WithFaker.php#L45
There is no ability to configure creating of Faker via DI container. It would be more flexible if we use app()->make(\Faker\Generator::class)
app()->make(\Faker\Generator::class)
Agree, we just overwriten this function To do this and add the subclass to container ;-)
Here code of a trade that create a faker.
https://github.com/laravel/framework/blob/afcfcf27299f1cd3a5146ab6930f363bee453156/src/Illuminate/Foundation/Testing/WithFaker.php#L45
There is no ability to configure creating of Faker via DI container. It would be more flexible if we use
app()->make(\Faker\Generator::class)