I'm making a contact form with laravel 5.4 and I want to get an email when someone sends the contact form. I'm using Mailtrap to receive emails.
The problem I'm getting is that I get this error when I submit the form.
ErrorException in helpers.php line 533: htmlspecialchars() expects parameter 1 to be string, object given (View: C:\xampp\htdocs\website\app\Modules\Templates\Resources\Views\emails\contact.blade.php)
My contact function
public function contact()
{
$data = Input::all();
$rules = array(
'name' => '',
'email' => '',
'message' => '',
);
$validator = Validator::make($data, $rules);
if($validator->passes())
{
Mail::send('templates::emails.contact', $data, function($message){
$message->from(Input::get('email'), Input::get('name'));
$message->to('info@site.com', 'Info')->subject('Testing contact form');
});
Session::flash('success', 'Your message has been sent successfully.');
return back();
}else{
return back()->withErrors($validator);
}
}
and my contact.blade.php that is the information that gets sent to me
<h1>We been contacted by.... </h1>
<br />
<br />
<br />
<br />
via Shiva478