'Laravel dispatch doesn't create entry in jobs table

I have a laravel 7 website that has to dispatch some jobs when the user access some pages. On the controller I have the following line:

TheJob::dispatch()->delay(now()->addMinutes(1));

This way it should create an entry to the jobs table before executing the job, but when running it either on tinker or accessing the page itself, no entry is created on the jobs table and the job is not executed. The table does exist on the database and all settings to connect to the database are correct since the page you have to access requires information from other tables.

The job is also not failling since no entry is created on the failed_jobs table, and nothing is logged on storage/logs.

I have checked the .env file and QUEUE_CONNECTION is set to database and also tried php artisan config:cache to refresh the config cache, to no success. The config/queue.php file has not been changed since its creation.

What could be preventing from a job to be created on the jobs table?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source