title: Laravel | Auth::user()->id isn't working in AppServiceProvider
body: <p>I can get the Auth ID when i put it in any controller with </p>
  
  <pre><code>Auth::user()-&gt;id
  </code></pre>
  
  <p>But when i put it in AppServiceProvider.php , it returns `Trying to get property 'id' of non-object</p>
  
  <p>i don't understand why ? </p>
  
  <p>Eddit : I tried this but still not working </p>
  
  <pre><code>public function boot()
  {
      view()-&gt;composer('*', function ($view) 
  {
  if (Auth::check())
  {
      $id=Auth::user()-&gt;id;
      $idd=Person::where('user_id','=',$id)-&gt;get('photo');
  
      $view-&gt;with('idd', $idd );
      $view-&gt;with('id', $id );
  }
         });
  }
  </code></pre>
  
  <p>Error : 
  Argument 1 passed to Illuminate\Database\Grammar::columnize() must be of the type array, string given, called in </p>