You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.0 KiB
PHP
55 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace Illuminate\Database;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Illuminate\Database\Console\Seeds\SeedCommand;
|
|
|
|
class SeedServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Indicates if loading of the provider is deferred.
|
|
*
|
|
* @var bool
|
|
*/
|
|
protected $defer = true;
|
|
|
|
/**
|
|
* Register the service provider.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register()
|
|
{
|
|
$this->app->singleton('seeder', function () {
|
|
return new Seeder;
|
|
});
|
|
|
|
$this->registerSeedCommand();
|
|
|
|
$this->commands('command.seed');
|
|
}
|
|
|
|
/**
|
|
* Register the seed console command.
|
|
*
|
|
* @return void
|
|
*/
|
|
protected function registerSeedCommand()
|
|
{
|
|
$this->app->singleton('command.seed', function ($app) {
|
|
return new SeedCommand($app['db']);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Get the services provided by the provider.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function provides()
|
|
{
|
|
return ['seeder', 'command.seed'];
|
|
}
|
|
}
|