title: Laravel 5.2 - Auth::attempt() method does not persistently logs in users
body: <p>I'm trying to manually login and register users in my website, following the instructions I found in <a href="https://laravel.com/docs/5.1/authentication#authenticating-users" rel="nofollow">Laravel's Documentantion</a>, when I try to log in a registered user, with the correct credentials, <code>Auth::attempt()</code> logs in the user and returns true, however the user is lost in subsequent requests. </p>
  
  <p>Here's the controller used to login users:</p>
  
  <pre><code>public function login() {
      $username = Request::input('username');
      $password = Request::input('password');
  
      if (Auth::attempt(['username' =&gt; $username, 'password' =&gt; $password])) {
        return redirect()-&gt;route('accounts', [$username]);
      } else {
        return redirect('/');
      }
    }
  </code></pre>
  
  <p>After redirecting to the user page, there is no user session.</p>
  
  <p>After checking if Sessions are working properly (I'm using the database driver), I have noticed that Laravel creates session data into the database right after the execution of <code>Auth::attempt()</code>, however the <code>user_id</code> field is <code>NULL</code>, which is why users does not remain logged in. My users table contains all the necessary fields, with only 3 additional fields (<code>first_name</code>, <code>last_name</code> and <code>username</code>). I cannot figure out why the <code>attempt()</code> method is not correctly creating the user session after successfully authenticating the user credentials, even though Sessions are working fine.</p>
  
  <p>EDIT: Even using the AuthController methods for creating and logging in users it does not work, I get the same results, a Session with no <code>user_id</code> information. What could possibly cause Sessions/Authentication to behave like this?</p>