Laravel Notification Queue

执行

php artisan queue:table

php artisan migrate

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

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

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

这是待处理的,

批注 2020-07-07 012320

一旦执行 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


批注 2020-07-07 011358

重启服务

执行

php artisan config:clear

执行

php artisan queue:work

运行中:

批注 2020-07-07 011924

posted @ 2020-07-07 01:19  dzkjz  阅读(238)  评论(0编辑  收藏  举报