Skip to content

Instantly share code, notes, and snippets.

@samundra
Created February 12, 2017 09:56
Show Gist options
  • Save samundra/901cd62fa98f0673b1cbbeec2ec17c3b to your computer and use it in GitHub Desktop.
Save samundra/901cd62fa98f0673b1cbbeec2ec17c3b to your computer and use it in GitHub Desktop.
Provides the "make:seeder" command in Lumen5.3.*
<?php
/**
* Filename: App/Providers/MakeSeedServiceProvider.php
*/
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Database\Console\Seeds\SeederMakeCommand;
class MakeSeedServiceProvider 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->registerMakeSeedCommand();
$this->commands('command.seed.make');
}
/**
* Register the seed console command.
*
* @return void
*/
protected function registerMakeSeedCommand()
{
$this->app->singleton('command.seed.make', function ($app) {
return new SeederMakeCommand($app['files'], $app['composer']);
});
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return ['command.seed.make'];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment