Serialization of 'Closure' is not allowed in Laravel 5.3 Email Queue

穿精又带淫゛_ 提交于 2019-12-05 08:06:09

You cannot serialize request. Only eloquent model can be serialized and unserialzed. See here: https://laravel.com/docs/5.2/queues#writing-job-classes

You should use $request->all() instead of $request. Since Request is treated as closure.

Try removing this line from constructor:

$this->message = new Message();

and, in the handle directly initialise it.

$student = $this->data;
$arrStudent = (new Message())->getEmailAddressList($student);
Mail::to($arrStudent)->send(new MessageSent($student));

It happened to me in Laravel 5.6. I just added this:

use Illuminate\Support\Facades\Mail;

And everything worked well.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!