Laravel - Artisan Console - Registering Commands
All of your console commands are registered within your application's App\Console\Kernel
class, which is your application's "console kernel". Within the commands
method of this class, you will see a call to the kernel's load
method. The load
method will scan the app/Console/Commands
directory and automatically register each command it contains with Artisan. You are even free to make additional calls to the load
method to scan other directories for Artisan commands:
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
$this->load(__DIR__.'/../Domain/Orders/Commands');
// ...
}
If necessary, you may manually register commands by adding the command's class name to the $commands
property of your App\Console\Kernel
class. When Artisan boots, all the commands listed in this property will be resolved by the service container and registered with Artisan:
protected $commands = [
Commands\SendEmails::class
];