Laravel - Artisan Console - Queueing Artisan Commands

Using the queue method on the Artisan facade, you may even queue Artisan commands so they are processed in the background by your queue workers. Before using this method, make sure you have configured your queue and are running a queue listener:

    
    use Illuminate\Support\Facades\Artisan;
    
    Route::post('/user/{user}/mail', function ($user) {
        Artisan::queue('mail:send', [
            'user' => $user, '--queue' => 'default'
        ]);
    
        //
    });
	

Using the onConnection and onQueue methods, you may specify the connection or queue the Artisan command should be dispatched to:

    
    Artisan::queue('mail:send', [
        'user' => 1, '--queue' => 'default'
    ])->onConnection('redis')->onQueue('commands');