title: Getting Auth User ID in Laravel
body: <p>If a user logs in Laravel 5.1 we can access user id </p>
  
  <pre><code>Auth::user()-&gt;id
  </code></pre>
  
  <p>In my previous app (not laravel) when a user logs in I'm registering a session for userid. And I was checking $_SESSION['user_id'] is available or not.</p>
  
  <p>I want to ask that when i call <code>Auth::user()-&gt;id</code> is it generates and sql query for every request ? If it does it is not good for performance.</p>
  
  <p>Should I register a new session like </p>
  
  <pre><code>Session::put('user_id', Auth::user()-&gt;id);
  </code></pre>
  
  <p>for performance.</p>
  
  <p>Or Auth:user()->id is best choice ?</p>