title: How to log user in via API - Laravel 5.8?
body: <p>I'm using Laravel 5.8, with PHP 7.2.</p>
  
  <p>I need to adjust the way I did the Authentication. </p>
  
  <h1>before</h1>
  
  <p>I used to log my users in via my local database from users table. </p>
  
  <p>If the email+password match, I log them in.</p>
  
  <pre><code>$email = strtolower(Input::get('email'));
  $password = Input::get('password');
  
  $dbAuth = Auth::attempt(array(
      'email' =&gt; $email,
      'password' =&gt; $password,
      'active' =&gt; 1
  ));
  
  if ($dbAuth) {
      Session::put('user', Auth::user());
      return Redirect::to('/dashboard')-&gt;with('success', 'You have been successfully logged in.');
  
  } else {
      return Redirect::to('/')-&gt;with('error', 'Username/Password Wrong')-&gt;with('email', $email)-&gt;withErrors($validator);
  }
  </code></pre>
  
  <h1>now</h1>
  
  <p>Now I need to call <code>/login</code> API, that will return a <code>token</code>.
  I need to store that <strong>token</strong> into the local storage on my browser. </p>
  
  <p>I need to make sure my <code>Auth::user()</code> will work base on change.</p>
  
  <p>How do I start ?</p>
  
  <p>Can someone please shed some lights ? </p>