I would like to send Data to a NewsletterStore Job. But it\'s failing with the following error. Any suggestions?
I also tried to remove the SerializesModels Models trait
Request
is not serializable there is a workaround what you are trying to achieve
public function store(StoreNewsletterRequest $request)
{
StoreNewsletterJob::dispatch($request->all());
return view('backend.dashboard.index');
}
Your job handler.
public function handle()
{
if(!Newsletter::isSubscribed($this->request['email']))
{
Newsletter::subscribe($this->request['email'], [
config('newsletter.list_fields.firstname') => $this->request->firstname,
config('newsletter.list_fields.lastname') => $this->request->lastname
]);
}
}
Hope this helps