1. New class inheritance in App->console->commands Illuminate\console\command
<?php namespace App\console\commands; UseIlluminate\console\command;classTestcommandextendscommand{/** * Command line execution command * @var string*/ protected $signature= ' Test_command '; /** * Command Description * * @var string*/ protected $description= ' Command description '; /** * Create a new command instance. * * @return void*/ Public function__construct () {Parent::__construct (); } /** * Execute the console command. * * @return Mixed*/ Public functionhandle () {//write the actions that need to be performed here }}
2. Add the current command class to the Commands array in app->console->kernel.php Testcommand::class
protected $commands = [ testcommand::class,];
3. View commands
PHP Artisan List
4 Execute Test_command command
PHP Artisan Test_command
Lumen Console Commands