I am running an Artisan command from a controller in my Laravel app. As the docs specify, you can queue like this:
Artisan::queue('email:send', [
'user' => 1, '--queue' => 'default'
]);
This takes care the queue logic and, in my case, sends the job off to Redis where it's processed almost immediately.
I want to delay the job. You can normally do this when calling a queue command like so:
$job = (new SendReminderEmail($user))->delay(60);
$this->dispatch($job);
Is there a way to join these functions so I can delay my Artisan command for 5 minutes? I assumed there's be a simple option to delay it.
If not, I could create another Job class to stand between my controller and Artisan command, which I could queue in the normal way and delay, then have that Job call my Artisan command. But this seems like a really convoluted way to make it work. Is there a better way to delay a queued Artisan command?
Thank you