title: Laravel - How to get current user in AppServiceProvider
body: <p>So I am usually getting the current user using <code>Auth::user()</code> and when I am determining if a user is actually logged in <code>Auth::check</code>. However this doesn't seem to work in my <code>AppServiceProvider</code>. I am using it to share data across all views. I <code>var_dump</code> both <code>Auth::user()</code> and <code>Auth::check()</code> while logged in and I get <code>NULL</code> and <code>false</code>. </p>
  
  <p>How can I get the current user inside my <code>AppServiceProvider</code> ? If that isn't possible, what is the way to get data that is unique for each user (data that is different according to the <code>user_id</code>) across all views. Here is my code for clarification.</p>
  
  <pre><code>if (Auth::check()) {
          $cart = Cart::where('user_id', Auth::user()-&gt;id);
          if ($cart) {
              view()-&gt;share('cart', $cart);
  
          }
      } else {
          view()-&gt;share('cartItems', Session::get('items'));
      }
  </code></pre>