title: How to add additional condition to Laravel 6 Auth attempt() method?
body: <p>I'm using Larvel 6</p>
  
  <p>I want to add this feature to my app:</p>
  
  <p>The app receives User's mobile number, then generates a <code>mobile_number_verification_code</code> like <code>145787</code> and updates user's table! then the generated code will be sent as SMS for user! and he/she enters the code to login! </p>
  
  <p><strong>Notice:</strong> the code can be used <strong>just 2 minutes</strong> after the generation time</p>
  
  <p>this will be the <code>User</code> model</p>
  
  <pre><code>    Schema::create('users', function (Blueprint $table) {
          $table-&gt;bigIncrements('id');
          $table-&gt;string('name');
          $table-&gt;string('email')-&gt;unique();
          $table-&gt;string('username')-&gt;unique()-&gt;nullable();
          $table-&gt;string('mobile_number')-&gt;unique()-&gt;nullable();
          $table-&gt;string('mobile_number_verification_code')-&gt;nullable();
          $table-&gt;string('mobile_number_verification_code_expires_at')-&gt;nullable();
          $table-&gt;bigInteger('mobile_number_verified_at')-&gt;nullable();
          $table-&gt;timestamp('email_verified_at')-&gt;nullable();
          $table-&gt;string('password');
          $table-&gt;rememberToken();
          $table-&gt;timestamps();
      });
  </code></pre>
  
  <p>I want to use the Laravel default auth way, so I can use this code for attempt to login:</p>
  
  <pre><code>/**
   * Attempt to log the user into the application.
   *
   * @param \Illuminate\Http\Request $request
   * @return bool
   */
  protected function attemptLogin(Request $request)
  {
      return $this-&gt;guard('users')-&gt;attempt(
          [
              'mobile_number' =&gt; '9128889966', // the mobile number
              'mobile_number_verification_code' =&gt; '145787' // the code which user has received
          ]
          , $request-&gt;filled('remember')
      );
  }
  </code></pre>
  
  <p>everything seems alright but one important point is missed:
  <em>the code can be used <strong>just 2 minutes</strong> after the generation time</em></p>
  
  <p>How can I check the code is expired or not?
  I know that I can check it after user login, then if the code is expired, use <code>Auth::logout();</code>  to logout him/her! but is it the best way?
  It is not better to edit the <code>attempt()</code> method?</p>