Level 14
@blueyan Did you:
php artisan queue:table
php artisan migrate
...before switching the queue driver to database?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
The Queue is running ok when
.env QUEUE_DRIVER=sync
When I change QUEUE_DRIVER=database
and run php artisan queue:work
I encountered the following error
[2017-10-04 22:02:55] local.ERROR: ErrorException: Trying to get property of non-object in \app\Jobs\ExportReport.php:42
Stack trace:
#0 \app\Jobs\ExportReport.php(42): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Trying to get p...', 42, Array)
#1 [internal function]: App\Jobs\ExportReport->handle()
here is ExportReport.php:42
42 $exportDelete = ExportsQueue::where('usrcreated', Auth::user()->USERKEY)
43 ->where('jobname', $this->reportrequest)
44 ->whereDate('dtcreated', DB::raw('CURDATE()'))->first();
Can we use Eloquent in Job Class when QUEUE_DRIVER=database ? It works if QUEUE_DRIVER=sync.
Please help. Thanks.
Please or to participate in this conversation.