pai-sklep/app/Providers/FakerServiceProvider.php

26 lines
516 B
PHP
Raw Normal View History

2021-09-05 02:22:17 +02:00
<?php
namespace App\Providers;
use App\Faker\ProductNameProvider;
use Illuminate\Support\ServiceProvider;
use Faker\{Factory, Generator};
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));
return $faker;
});
}
}