laravellaravel-queue

Laravel Queue not inserting into the table, but the work still executes


So i am trying to create a queued job but it doesn't get added to the database or php artisan queue:listen database does not show anything. However, the work inside the handle() function gets executed.

The Job class:

class OrderCreatedJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    public function __construct() {
        //
    }

    public function handle() {
        Notification::route('mail', 'my@email.com')->notify(new TestNotif());
    }
}

Controller function (also note that the addMinutes delay never happens, its sent straight away)

public function jobTest() {
    $this->dispatch((new OrderCreatedJob())->delay(Carbon::now()->addMinutes(1)));
}

In .env I have the QUEUE_DRIVER=database added as well.

So the issue is the email is being sent but it is being done straight away, and the browser still takes time for the request. The job also doesnt appear in the database, neither does the delay work as well.

Where am i going wrong?


Solution

  • So the fix was to have QUEUE_CONNECTION=database inside the env file, instead of QUEUE_DRIVER=database