第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

Laravel - 通知郵件 ShouldQueue 不起作用

Laravel - 通知郵件 ShouldQueue 不起作用

PHP
繁星淼淼 2023-05-12 15:51:02
我想使用隊(duì)列發(fā)送電子郵件通知。我已經(jīng)創(chuàng)建了隊(duì)列表并跟蹤了與該主題相關(guān)的所有文檔,但通知是在不經(jīng)過隊(duì)列的情況下發(fā)送的。在我的控制器中:Notification::send(User::role('team')->get(), new NewExchangeToCollaboratorNotification($user, $exchange, $firstMessage));我的通知代碼是:<?phpnamespace App\Notifications;use Illuminate\Bus\Queueable;use Illuminate\Contracts\Queue\ShouldQueue;use Illuminate\Notifications\Messages\MailMessage;use Illuminate\Notifications\Notification;use Setting;class NewExchangeToCollaboratorNotification extends Notification implements ShouldQueue{    use Queueable;    protected $user; protected $exchange; protected $exchangeMessage; protected $replyToAddress;    public function __construct($user, $exchange, $exchangeMessage)    {        $this->user = $user;        $this->exchange = $exchange;        $this->exchangeMessage = $exchangeMessage;        $this->replyToAddress = Setting::get('MAIL_REPLY_TO_ADDRESS', env('MAIL_FROM_ADDRESS'));    }    public function via($notifiable)    {        return ['mail'];    }    public function toMail($notifiable)    {        return (new MailMessage)->view(            'emails.exchanges.new',            [                'user' => $this->user,                'exchangeMessage' => $this->exchangeMessage,                'exchange' => $this->exchange            ]        )   ->subject('New exchange: ' .  $this->exchange->title)            ->from(env('MAIL_FROM_ADDRESS'))            ->replyTo($this->replyToAddress);    }}通知是否可以排隊(duì)?我做錯(cuò)了什么嗎? 謝謝您的回答 :)編輯:添加延遲也不起作用。$when = now()->addMinutes(10);Notification::send(User::role('team')->get(), (new NewExchangeToCollaboratorNotification($user, $exchange, $firstMessage))->delay($when));編輯 2:沒有失敗的工作
查看完整描述

1 回答

?
慕的地10843

TA貢獻(xiàn)1785條經(jīng)驗(yàn) 獲得超8個(gè)贊

確保您的 .env 是: QUEUE_CONNECTION=database



查看完整回答
反對 回復(fù) 2023-05-12
  • 1 回答
  • 0 關(guān)注
  • 182 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號