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,我没有改变它,正如我所提到的,我使用同步作为驱动程序 任何建议的解决方案?