Laravel - Artisan Console - Closure Commands

Closure based commands provide an alternative to defining console commands as classes. In the same way that route closures are an alternative to controllers, think of command closures as an alternative to command classes. Within the commands method of your app/Console/Kernel.php file, Laravel loads the routes/console.php file:

     * Register the closure based commands for the application.
     * @return void
    protected function commands()
        require base_path('routes/console.php');

Even though this file does not define HTTP routes, it defines console based entry points (routes) into your application. Within this file, you may define all of your closure based console commands using the Artisan::command method. The command method accepts two arguments: the command signature and a closure which receives the command's arguments and options:

    Artisan::command('mail:send {user}', function ($user) {
        $this->info("Sending email to: {$user}!");

The closure is bound to the underlying command instance, so you have full access to all of the helper methods you would typically be able to access on a full command class.