mercredi 26 avril 2017

Laravel queueable notification errors: Serialization of 'Closure' is not allowed

I've created a mail notification that works successfully, but when trying to queue it, I get the following error:

Uncaught Exception: Serialization of 'Closure' is not allowed in /vendor/laravel/framework/src/Illuminate/Queue/Queue.php:125

Below is my code that I believe is causing the error:

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]);
}

I am not exactly sure where the 'Closure' it's trying to serialize is coming from. I tried tacking on ->render() to the end of View::make but that did not seem to make a difference. I believe it may have something to do with the view function of the MailMessage but I'm not really sure.

Once again, this notification works perfectly when it is not being Queued.

Any help would be appreciated.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2oxqjmd
via IFTTT

Aucun commentaire:

Enregistrer un commentaire