title: Laravel htmlspecialchars() expects parameter 1 to be string, object given in my project?
body: <p>So i'm trying to code a simple website form. But it has this htmlspecialchars error.</p>
  
  <p>I've tried to make {{ $message }} but it didn't work. has the same error.</p>
  
  <p>this is my controller : </p>
  
  <pre><code>&lt;?php
  namespace App\Http\Controllers;
  use Mail;
  use Illuminate\Http\Request;
  class ContactMessageController extends Controller
  {
  public function create()
      {
          return view('form');
      }
  
  public function store(Request $request)
  {
      $this-&gt;validate($request, [
          'name' =&gt; 'required',
          'email' =&gt; 'required|email',
          'address' =&gt; 'required',
      ]);
  
      Mail::send('emails.contact-message', [
          'message' =&gt; $request-&gt;message
      ], function($mail) use($request) {
          $mail-&gt;from($request-&gt;email, $request-&gt;name);
  
          $mail-&gt;to('john@example.com')-&gt;subject('Contact message');
      });
  
          return redirect()-&gt;back()-&gt;with('flash_message', 'thanks');
      }
  }
  </code></pre>
  
  <p>and this is my blade</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8" /&gt;
  &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
  &lt;title&gt;Customer Details&lt;/title&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
  &lt;link rel="stylesheet" type="text/css" media="screen" href="main.css" /&gt;
  &lt;link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.0/css/bootstrap.min.css" integrity="sha384-PDle/QlgIONtM1aqA2Qemk5gPOE7wFq8+Em+G/hmo5Iq0CCmYZLv3fVRDJ4MMwEA" crossorigin="anonymous"&gt;
  &lt;style&gt;
      .invalid-feedback {
          display: block;
      }
  &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div class ="container"&gt;
      &lt;h1&gt;Customer Form&lt;/h1&gt;
          @if (Session::has('flash_message'))
              &lt;div class="alert alert-success"&gt;{{ Session::get('flash_message') }}&lt;/div&gt;
          @endif
      &lt;form method="post" action="{{ route('contact.store') }}"&gt;
      {{ csrf_field() }}
          &lt;div class="form-group"&gt;
              &lt;label&gt;Full Name : &lt;/label&gt;
              &lt;input type="text" class="form-control" name="name"&gt;
              @if ($errors-&gt;has('name'))
                  &lt;small class="form-text invalid-feedback"&gt;{{ $errors-&gt;first('name') }}&lt;/small&gt;
              @endif
          &lt;/div&gt;
  
          &lt;div class="form-group"&gt;
              &lt;label&gt;Email : &lt;/label&gt;
              &lt;input type="text" class="form-control" name="email"&gt;
              @if ($errors-&gt;has('email'))
                  &lt;small class="form-text invalid-feedback"&gt;{{ $errors-&gt;first('email') }}&lt;/small&gt;
              @endif
          &lt;/div&gt;
  
          &lt;div class="form-group"&gt;
              &lt;label&gt;Address : &lt;/label&gt;
              &lt;textarea name="address" class ="form-control"&gt;&lt;/textarea&gt;
              @if ($errors-&gt;has('address'))
                  &lt;small class="form-text invalid-feedback"&gt;{{ $errors-&gt;first('address') }}&lt;/small&gt;
              @endif
          &lt;/div&gt;
  
          &lt;div class="form-group"&gt;
              &lt;label&gt;Message : &lt;/label&gt;
              &lt;textarea name="message" class ="form-control"&gt;&lt;/textarea&gt;
              @if ($errors-&gt;has('message'))
                  &lt;small class="form-text invalid-feedback"&gt;{{ $errors-&gt;first('message') }}&lt;/small&gt;
              @endif
          &lt;/div&gt;
  
          &lt;button class="btn btn-primary"&gt;Submit&lt;/button&gt;
  
  
      &lt;/form&gt;
  &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and this is my contact-message.blade.php</p>
  
  <pre><code>{{ $message }}
  </code></pre>
  
  <p>also i've tried
      {{dd($message)}}</p>
  
  <p>but it didnt work.</p>
  
  <p>please help.</p>