Defer the execution of artisan commands on the queue
4
Sometimes you may wish to defer the execution of some custom artisan command. Here is how you do it in October:
use Carbon\Carbon;
use Illuminate\Foundation\Console\QueuedCommand;
QueuedCommand::dispatch(['mycommand:do-something', ['argument' => $value]])->delay(Carbon::now()->addMinutes(30));
Like this, the command will be pushed on the queue and the execution will start after 30 minutes. Don't forget to set up your queue workers!
There are no comments yet
Be the first one to comment