How to use Models in a Laravel Queue

此生再无相见时 提交于 2019-12-05 23:50:54

Since you don't see other errors, I'm thinking this is an environment issue.

First - environments

Make sure your call to php artisan queue:listen (or queue:work, if applicable) is using the correct environment so the correct database is getting used:

$ php artisan queue:listen --env=YOUR_ENV

Here's a post on setting up queues in Laravel 4 which might be helpful for more information.

Second - namespaces

As you (apparently?) aren't seeing any PHP errors, this is less likely, but another idea:

If your class is namespaced, you may need to use the \ character to get your models, which are in the global namespace.

// From:
$mailing = new Mailing();

// To:
$mailing = new \Mailing();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!