title: Laravel 5 want to access auth user id in model
body: <p>I want to access the currently logged In user ID in the model. So in the model, I have written the codes;</p>
  
  <pre><code>namespace App\Model;
  use Illuminate\Database\Eloquent\Model;
  use Illuminate\Support\Facades\DB;
  use Auth;
  </code></pre>
  
  <p>and in the method under the model, I used this code: <code>Auth::user()-&gt;id</code>
  However, I receives the error:</p>
  
  <blockquote>
    <p>Trying to get property of non-object</p>
  </blockquote>