Because you are in a closure, or function, variables declared outside of the function are not available to you, this is the same as how standard PHP works where you'd need to declare global $variable to get access to your variables that are declared outside the scope of your function.
To access variables inside a closure you can use the following.
Mail::queue('emails.order', $data, function($message) use ($email, $ename)
{
$message->from('[email protected]', 'Denis Romanenko'); $message->to($email, $ename)->subject("Your order");
});
iWader, thank you very much, nice explanation for unskilled programmer like me :)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community