Closure doesn't have access to variables in the scope it was defined in. You have to pass $toUser
and $subject
to it explicitly by adding use($toUser, $subject)
:
Mail::send('emails.comment_wallpost', $data, function($message) use($toUser, $subject) {
$message->to($toUser['email'], $toUser['displayname'])->subject($subject);
});
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community