在本地,我的Laravel 5.2项目运行良好,包括使用Redis排队的事件。
IMPORTANT UPDATE: I later discovered that this premise was incorrect (and my events don't use Redis), and so I'd accidentally posted this question in a misleading way. I hope my ridiculously long struggle and my answer below will be helpful to someone else who is an events newbie too.
但是我已经将项目部署到了生产服务器(在这里我使用的是Laradock Docker安装程序)。
在生产中,Redis在工作时用于缓存和延迟分发作业。
所以我知道我的Redis设置很好。
但是事件不起作用(即使它们在我的项目在本地计算机上时也起作用)。
我的问题不是Laravel 5.2 event not firing in production的副本,因为我没有使用广播,而且因为我使用的是Laradock。
我也已经尝试过这些命令(在
docker exec -it laradock_workspace_1 bash
的容器内):php artisan config:cache
php artisan clear-compiled
php artisan optimize
composer install --no-dev
composer dumpautoload
php artisan queue:restart
最佳答案
我的 Activity 正在制作中。这是我学到的:
Illuminate\Contracts\Queue\ShouldQueue
,所以一切都是同步的,应该比我想的更直接。 composer dumpautoload
和php artisan clear-compiled
的https://laravel.com/docs/5.2/events很有帮助(适用于在生产中每次编辑文件后)。 希望我的幼稚和误导性问题(导致这场荒谬的漫长斗争和这个答案)也将对其他 Activity 新手有所帮助。
关于laravel - 为什么我的Laravel 5.2事件在本地工作时不能在生产中工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57732175/