队列通知laravel 5.3问题

Ach*_*dja 2 php queue ubuntu laravel laravel-5.3

我正在测试这个在laravel 5.3中实现的新通知内容及其优秀,

我有这个通知类,它发送邮件给经过身份验证的用户(当他点击特定路由时),这是默认代码.

通知

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;

class notifyme extends Notification  implements ShouldQueue
{
    use Queueable;

    public function __construct()
    {
        //
    }
    public function via($notifiable)
    {
        return ['mail'];
    }
    public function toMail($notifiable)
    {
        return (new MailMessage)
                    ->line('The introduction to the notification.')
                    ->action('Notification Action', 'https://laravel.com')
                    ->line('Thank you for using our application!');
    }
Run Code Online (Sandbox Code Playgroud)

这是实例化通知类的控制器函数

public function notifyme()
    {
        $user = Auth::user()

        $user->notify(new notifyme($user));
        //$user->notify((new notifyme($user))->delay(Carbon::now()->addMinutes(10)));

         return redirect('/home');
    }
Run Code Online (Sandbox Code Playgroud)

现在使用ubuntu操作系统,并将我的队列驱动程序设置为同步,这应该在localhost上正常工作 QUEUE_DRIVER="sync"

我开始做一名工人 php artisan queue:work

但终端窗口上没有任何显示页面仍然有点慢(队列不工作) 在此输入图像描述

我有默认的queue.php,我没有改变它,正如我所提到的,我使用同步作为驱动程序 任何建议的解决方案?

Bog*_*nik 7

sync 驱动程序不使用队列,它允许同步运行作业以运行测试.

您需要使用此处列出的laravel提供的驱动程序之一 - Laravel队列,或安装一些自定义,如RabbitMQ或其他