2021-09-05 02:22:17 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
2021-12-08 23:39:53 +01:00
|
|
|
use App\Faker\CategoryNameProvider;
|
2021-09-05 02:22:17 +02:00
|
|
|
use App\Faker\ProductNameProvider;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
|
2021-11-14 14:51:49 +01:00
|
|
|
use Faker\Factory;
|
|
|
|
use Faker\Generator;
|
2021-09-05 02:22:17 +02:00
|
|
|
|
|
|
|
class FakerServiceProvider extends ServiceProvider
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Register services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function register()
|
|
|
|
{
|
|
|
|
$this->app->singleton(Generator::class, function () {
|
|
|
|
$faker = Factory::create();
|
|
|
|
$faker->addProvider(new ProductNameProvider($faker));
|
2021-12-08 23:39:53 +01:00
|
|
|
$faker->addProvider(new CategoryNameProvider($faker));
|
2021-09-05 02:22:17 +02:00
|
|
|
return $faker;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|