When processing a request from a form it is I pass the $request parameters to a email template:
public function store(CreateFormRequest $request)
{
Mail::send('emails.contact',
array(
'firstname' => $request->get('firstname'),
'familyname' => $request->get('familyname'),
'email' => $request->get('email')
), function ($message)
{
$message->from('noreply@senderdomain.com');
$message->to('subscriber@subscriberdomain.com', 'Subscriber name')->subject('Thank you for subscribing');
});
}
Is it possible to pass the $request parameters at once as Array?
Like this:
Mail::send('emails.contact',
$request->toArray(), function ($message)
{
$message->from('noreply@senderdomain.com');
$message->to('subscriber@subscriberdomain.com', 'Subscriber name')->subject('Thank you for subscribing');
});
toArray() is of course not working but is there a way to do this? Or is this a security issue?