title: Laravel 5 session not persisting after user is logged in
body: <p>I'm having an interesting issue with Laravel 5.</p>
  
  <p>After logging in a user, the logged in status is not persisted across pages. Clearly it has something to do with <code>Session::</code>.</p>
  
  <p>The way I'm logging in a user is pretty straight-forward:</p>
  
  <pre><code>if (Auth::attempt(['email' =&gt; $data['email'], 'password' =&gt; $data['password']],
      isset($data['remember_me']) ? TRUE : FALSE))
  {
      return redirect()-&gt;intended('/');
  }
  </code></pre>
  
  <p>A simple <code>print_r(Session::all());</code> gives me the following if the user is NOT logged in:</p>
  
  <pre><code>Array
  (
      [_token] =&gt; wV8o75lZnCZ0f6CMMQgdBBM2AxSYjtWisAXx6TgZ
      [flash] =&gt; Array
          (
              [old] =&gt; Array
                  (
                  )
  
              [new] =&gt; Array
                  (
                  )
  
          )
  
      [_previous] =&gt; Array
          (
              [url] =&gt; http://localhost/public
          )
  
  )
  </code></pre>
  
  <p>After the user is logged in an redirected to <code>/</code> the array looks like this:</p>
  
  <pre><code>Array
  (
      [_token] =&gt; wV8o75lZnCZ0f6CMMQgdBBM2AxSYjtWisAXx6TgZ
      [flash] =&gt; Array
          (
              [old] =&gt; Array
                  (
                  )
  
              [new] =&gt; Array
                  (
                  )
  
          )
  
      [_previous] =&gt; Array
          (
              [url] =&gt; http://localhost/public/
          )
  
      [login_82e5d2c56bdd0811318f0cf078b78bfc] =&gt; 2
  )
  </code></pre>
  
  <p>However, after any action that will lead to a page refresh or a redirect, the session status is lost.</p>
  
  <p>My <code>config/session.php</code> file looks like so:</p>
  
  <pre><code>&lt;?php
  
  return [
      'driver' =&gt; env('SESSION_DRIVER', 'file'),
      'lifetime' =&gt; 120,
      'expire_on_close' =&gt; false,
      'encrypt' =&gt; false,
      'files' =&gt; storage_path('framework/sessions'),
      'connection' =&gt; null,
      'table' =&gt; 'sessions',
      'lottery' =&gt; [2, 100],
      'cookie' =&gt; 'laravel_session',
      'path' =&gt; '/',
      'domain' =&gt; null,
      'secure' =&gt; false,
  
  ];
  </code></pre>
  
  <p>The locally stored file for the session can be written and read.</p>
  
  <p>I've tried using <code>database</code> drive instead of file. Same thing happens the <code>[login_xx] =&gt; 2</code> key/value is lost and I'm logged out.</p>
  
  <p>Since the <code>Session::</code> is not completely reset I'm suspecting that I'm not logging in the  user properly or simply doing something that I shouldn't be doing somewhere.</p>