title: Laravel 5.5 Trying to get property of non-object
body: <pre><code>public function __construct()
  {
      view()-&gt;share('tags', DB::table('tags')-&gt;where('view', Auth::user()-&gt;view)-&gt;get());
      $this-&gt;middleware('auth');
  }
  </code></pre>
  
  <p>I receive: </p>
  
  <blockquote>
    <p>(1/1) ErrorException
    Trying to get property of non-object</p>
  </blockquote>
  
  <p>Why? When I try to <code>return Auth::user()-&gt;view;</code> I got <strong>2</strong>. But when I manually type <code>-&gt;where('view', 2)</code> then everything is ok. How can I fix this? Thanks in advance.</p>