title: Trying to get property 'post_title' of non-object
body: <p><strong>controller</strong></p>
  
  <pre><code>public function update_homepage(){
      $contents = DB::table('posts')-&gt;select('post_title','post_excerpt')
                                    -&gt;latest()
                                    -&gt;first();
      return view('index', ['contents' =&gt; $contents]);
  }
  </code></pre>
  
  <p><strong>index view</strong></p>
  
  <pre><code> @foreach ($contents as $details)
        &lt;h4&gt;{{$details-&gt;post_title}}&lt;/h4&gt;
   @endforeach
  </code></pre>
  
  <p>I get an error: </p>
  
  <blockquote>
    <p>Trying to get property 'post_excerpt' of non-object</p>
  </blockquote>