Log::info('Sending email', array(
'title' => $attributes['title'],
'recipient' => $attributes['email']
));
Mail::queue('emails.welcome', $attributes, function($message) use ($attributes)
{
$message
->to($attributes['email'])
->subject($attributes['title']);
});
Run Code Online (Sandbox Code Playgroud)
传递给闭包的问题是什么Mail::queue
.怎么了?这与文档中的内容完全相同.
好吧,我假设您$attributes
正在尝试将其传递给电子邮件视图welcome
。如果是,那么您需要将其放入数组中。在这种情况下,应该是这样的:
Mail::queue('emails.welcome', array('attributes' => $attributes), function($message) use ($attributes)
{
$message
->to($attributes['email'])
->subject($attributes['title']);
});
Run Code Online (Sandbox Code Playgroud)
...这可能对你有用!:D