title: Laravel - Getting wrong guard model when I try to use multi authentication
body: <p>I'm having some problems with Laravel 5.7 multi-auth implementation.</p>
  
  <p>I have created a new table for backend login: "AdminUsers".</p>
  
  <p>So, I modified auth.php file:</p>
  
  <pre><code>return [
      'defaults' =&gt; [
          'guard' =&gt; 'web',
          'passwords' =&gt; 'users',
      ],
  
  
      'guards' =&gt; [
          'web' =&gt; [
              'driver' =&gt; 'session',
              'provider' =&gt; 'users',
          ],
          'admin' =&gt; [
              'driver' =&gt; 'session',
              'provider' =&gt; 'admins',
          ],
  
          'api' =&gt; [
              'driver' =&gt; 'token',
              'provider' =&gt; 'users',
          ],
      ],
  
      'providers' =&gt; [
          'users' =&gt; [
              'driver' =&gt; 'eloquent',
              'model' =&gt; Ecommerce\User::class,
          ],
          'admins' =&gt; [
              'driver' =&gt; 'eloquent',
              'table'  =&gt; Ecommerce\AdminUser::class,
          ],
      ],
  
      'passwords' =&gt; [
          'users' =&gt; [
              'provider' =&gt; 'users',
              'table' =&gt; 'password_resets',
              'expire' =&gt; 60,
          ],
          'admins' =&gt; [
              'provider' =&gt; 'admins',
              'table' =&gt; 'password_resets',
              'expire' =&gt; 60,
          ],
      ],
  ];
  </code></pre>
  
  <p>Then, I create the AdminLoginController class:</p>
  
  <pre><code>&lt;?php
  
  namespace Ecommerce\Http\Controllers\Admin\Auth;
  
  use Illuminate\Http\Request;
  use Ecommerce\Http\Controllers\Controller;
  use Illuminate\Foundation\Auth\AuthenticatesUsers;
  
  
  class AdminLoginController extends Controller
  {
  
      use AuthenticatesUsers;
  
      protected $redirectTo = '/index';
  
  
      public function __construct()
      {
          $this-&gt;middleware('guest')-&gt;except('logout');
      }
  
      public function showLoginForm()
      {
          return view('admin.auth.login');
      }
  
  
      protected function attemptLogin(Request $request)
      {
          return $this-&gt;guard('admin')-&gt;attempt(
              $this-&gt;credentials($request), $request-&gt;filled('remember')
          );
      }
  
  
      protected function authenticated(Request $request, $user)
      {
          dd('authenticated!');
      }
  
  
      public function username()
      {
          return 'username';
      }
  
  }
  </code></pre>
  
  <p>I setted this routes in routes file:</p>
  
  <pre><code>Route::get ('/login', ['uses'=&gt;'Auth\AdminLoginController@showLoginForm'])-&gt;name('login_page');
  Route::post('/login', ['uses'=&gt;'Auth\AdminLoginController@login'        ])-&gt;name('do_login'  );
  </code></pre>
  
  <p>The problem is, that when I do login, Laravel tries to use "users" guard instead of the defined "admin" guard. So that throw a SQL error (because I have not created the "Users" table in the DB).</p>
  
  <p>Even if I do <code>var_dump($this-&gt;guard('admin'))</code> inside <code>AdminLoginController::attemptLogin</code> method, the response gives me a SessionGuard object with "<code>Ecommerce\User</code>" instead of "<code>Ecommerce\AdminUser</code>" that is the one defined as "admin" in auth.php guard array.</p>
  
  <p>Anyone knows where else can I look to solve this?</p>
  
  <p>Thanks!</p>