title: Remember-me token: login event fired multiple times in the same second
body: <p>Laravel provides out-of-the-box events for authentication, so I'm using the <code>LoginListener</code> to log user logins in the database.</p>
  
  <pre><code>public function handle(Login $event) {
  
      if (!isset($event-&gt;user) || empty($event-&gt;user) ||
          !isset($event-&gt;user-&gt;userid) || empty($event-&gt;user-&gt;userid)) {
          return false;
      }
  
      if (Auth::viaRemember())
          Logins::create(array('userid' =&gt; $event-&gt;user-&gt;userid, 'type' =&gt; 3));
      }
  
  }
  </code></pre>
  
  <p>So, every time a user is being authenticated via the remember-me token, an entry is inserted in the <code>logins</code> table (user_id, type).</p>
  
  <p>Problem is, sometimes I get multiple inserts for the same login event - sometimes even 20 rows, all with the same <code>CURRENT_TIMESTAMP</code>, <code>user_id</code> and <code>type</code>. So, it seems the login event is fired multiple times and the listener, well, handles it multiple times, in the same single second</p>
  
  <p><strong>Why might this be happening?</strong></p>
  
  <p>Some background:</p>
  
  <ul>
  <li>The site architecture involves multiple hosts and load balancers.</li>
  <li>I'm using MySQL, with the <code>read</code> and <code>write</code> connections separated</li>
  <li>Laravel version: 5.4</li>
  <li>The multiple entries have been happening occasionally, in the span of
  the last few months</li>
  <li>The problem occurs on production and the development environment</li>
  <li>The event handler is not queued</li>
  </ul>