The code below doesn't work. I think I have done all things correctly, but somehow I doesn't work.
... MyJob::dispatch($job)->onQueue('processing')->delay(Carbon::now()->addSeconds(30)); ...
MyJob.php
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
class MyJob implements ShouldQueue
{
use InteractsWithQueue, Queueable, SerializesModels, Dispatchable;
public function __construct($job)
{
// I described a logging code here and yes, there was change, but then...
}
public function handle()
{
// I described a logging code here, but there wasn't change
}
}
The problem is that dispatchNow() did work, but dispatch with delay didn't work.
I also set .env correctly(I guess)
.env file ...
QUEUE_CONNECTION=database
...
config/queue.php ...
'default' => env('QUEUE_CONNECTION', 'sync'),
...
Please help me. Any advice would be nice. Thank you.