【发布时间】:2016-08-20 03:51:22
【问题描述】:
我正在测试这个在 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!');
}
这是实例化通知类的控制器函数
public function notifyme()
{
$user = Auth::user()
$user->notify(new notifyme($user));
//$user->notify((new notifyme($user))->delay(Carbon::now()->addMinutes(10)));
return redirect('/home');
}
现在使用 ubuntu os 并将我的队列驱动程序设置为同步,这应该可以在 localhost QUEUE_DRIVER="sync" 上正常工作
我开了一个工人php artisan queue:work
但是终端窗口上什么也没有显示,页面仍然有点慢(队列不起作用)
我有默认的 queue.php,但我没有更改它,正如我所提到的,我使用同步作为驱动程序 有什么建议的解决方案吗?
【问题讨论】:
标签: php laravel ubuntu queue laravel-5.3