首页 > 其他 > 详细

Laravel Notification Queue

时间:2020-07-07 09:22:16      阅读:77      评论:0      收藏:0      [点我收藏+]

执行

php artisan queue:table

php artisan migrate

但是运行过程中我的没有向数据库中添加记录

数据库会记录待处理的等,已经处理的会被删除掉。

不执行 php artisan queue:work 就会看到代发的记录了。

这是待处理的,

技术分享图片

一旦执行 php artisan queue:work

就会处理掉,数据库中记录也就被移除了。


不用执行

php artisan make:job 【你定义的queue的名字】

因为notification已经可以参考下面的方式简单的实现dispatch了

如果确实需要可以看官方的 在handle里面处理

然后用户类改为触发这个job即可

可以参考

https://stackoverflow.com/questions/52644934/how-to-queue-laravel-5-7-email-verification-email-sending



https://divinglaravel.com/how-laravels-notification-system-works


https://www.codechief.org/article/sending-notification-via-laravel-queue-example-from-scratch#gsc.tab=0


.env中

QUEUE_CONNECTION=database


config/queue.php默认不变

所有的需要queue的notifications实现should queue以及添加 queueable trait


技术分享图片

重启服务

执行

php artisan config:clear

执行

php artisan queue:work

运行中:

技术分享图片

Laravel Notification Queue

原文:https://www.cnblogs.com/dzkjz/p/13258634.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!