我創建了一個郵件通知成功的作品,但試圖排隊它的時候,我得到以下錯誤:Laravel QUEUEABLE通知錯誤:序列化「封閉」是不允許的
Uncaught Exception: Serialization of 'Closure' is not allowed in /vendor/laravel/framework/src/Illuminate/Queue/Queue.php:125
以下是我的代碼,我相信是會導致錯誤:
public function toMail($notifiable)
{
$view_file = 'emails.verifyEmail';
$view = View::make($view_file, ['invitationToken' => $this->invitationToken, 'team_name' => $this->team->name, 'team_domain' => $this->team->domain ]);
$view = new HtmlString(with(new CssToInlineStyles)->convert($view));
return (new MailMessage)
->subject('Email Verification')
->view('emails.htmlBlank', ['bodyContent' => $view]);
}
我不是很確定,其中「關閉」這是試圖序列的來源。我試圖在->render()
上加上View::make
的結尾,但這似乎沒有什麼區別。我相信這可能與MailMessage
的view
功能有關,但我不確定。
再次說明,此通知在未被排隊時完美工作。
任何幫助,將不勝感激。
如果您真的認爲它在這些行中,請通過從提供錯誤的行進行跟蹤來確定哪一行,或者使用步驟調試,或者在每個行之後使用「退出」語句來確定哪一行確切地拋出錯誤。然後你可以回家問題。 –
@PaulJeromeBordallo我知道哪一行導致錯誤。堆棧跟蹤沒有幫助,因爲它全部指向核心laravel代碼。我知道錯誤是什麼,我只是不知道如何解決它。 –