title: Laravel 5.4 : Get logged in user id inside __construct()
body: <p>I am trying to access <code>Auth::user()-&gt;id;</code> inside constructor but it always return the error <strong>Trying to get property of non-object</strong>. I study in the laravel documentation that Session is not accessible inside constructor and also search on SO for this. I need logged in user id inside constructor because I have to fetch data from database and make it available for all its method. My current code is : </p>
  
  <pre><code>public function __construct(){
      $this-&gt;middleware('auth');
      $induction_status = TrainingStatusRecord::where('user_id',Auth::user()-&gt;id)-&gt;where('training','=','induction')-&gt;get();
      View::share('ind_status',$induction_status);
  }  
  </code></pre>
  
  <p>Is there any way (easy way) to get logged in user id inside constructor. </p>
  
  <p>I will appreciate any help.</p>
  
  <p>Thank You</p>