title: Multi-Auth Auth::user() Showing null Laravel 5.8
body: <p>I am implementing multiple authentication as I have 3 different user groups. I am trying the following steps. </p>
  
  <p><strong>LoginController.php</strong></p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers\Auth;
  
  use App\Http\Controllers\Controller;
  use Illuminate\Foundation\Auth\AuthenticatesUsers;
  use Illuminate\Http\Request;
  
  use Auth;
  
  class LoginController extends Controller
  {
      use AuthenticatesUsers;
  
  
      protected $redirectTo = '/home';
  
  
      public function __construct()
      {
          $this-&gt;middleware('guest')-&gt;except('logout');
          $this-&gt;middleware('guest:admin')-&gt;except('logout');
          $this-&gt;middleware('guest:manager')-&gt;except('logout');
          $this-&gt;middleware('guest:vendor')-&gt;except('logout');
      }
  
      public function showAdminLoginForm()
      {
          return view('auth.login', ['url' =&gt; 'admin']);
      }
  
      public function adminLogin(Request $request)
      {
          $this-&gt;validate($request, [
              'email'   =&gt; 'required|email',
              'password' =&gt; 'required|min:6'
          ]);
  
          if (Auth::guard('admin')-&gt;attempt(['email' =&gt; $request-&gt;email, 'password' =&gt; $request-&gt;password], $request-&gt;get('remember'))) {
  
              return redirect()-&gt;intended('/admin');
          }
          return back()-&gt;withInput($request-&gt;only('email', 'remember'));
      }
  
      public function showManagerLoginForm()
      {
          return view('auth.login', ['url' =&gt; 'manager']);
      }
  
      public function managerLogin(Request $request)
      {
          $this-&gt;validate($request, [
              'email'   =&gt; 'required|email',
              'password' =&gt; 'required|min:6'
          ]);
  
          if (Auth::guard('manager')-&gt;attempt(['email' =&gt; $request-&gt;email, 'password' =&gt; $request-&gt;password], $request-&gt;get('remember'))) {
  
              return redirect()-&gt;intended('/manager');
          }
          return back()-&gt;withInput($request-&gt;only('email', 'remember'));
      }
  
      public function showVendorLoginForm()
      {
          return view('auth.login', ['url' =&gt; 'vendor']);
      }
  
      public function vendorLogin(Request $request)
      {
          $this-&gt;validate($request, [
              'email'   =&gt; 'required|email',
              'password' =&gt; 'required|min:6'
          ]);
  
          if (Auth::guard('vendor')-&gt;attempt(['email' =&gt; $request-&gt;email, 'password' =&gt; $request-&gt;password], $request-&gt;get('remember'))) {
  
              return redirect()-&gt;intended('/vendor');
          }
          return back()-&gt;withInput($request-&gt;only('email', 'remember'));
      }
  }
  </code></pre>
  
  <p><strong>AdminController.php</strong></p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  
  use Auth;
  
  class AdminController extends Controller
  {
      public function __construct()
      {
          $this-&gt;middleware('guest:admin');   
      }
  
      public function dashboard()
      {
          dd(auth()-&gt;user());
          return view('admin');
      }
  }
  </code></pre>
  
  <p><strong>ManagerController</strong> and <strong>VendorController</strong> are same As <strong>AdminController</strong>. </p>
  
  <p><strong>Web.php</strong></p>
  
  <pre><code>Route::view('/', 'welcome');
  Auth::routes();
  
  Route::prefix('admin')-&gt;group(function () {
      Route::get('/login', 'Auth\LoginController@showAdminLoginForm');
      Route::post('/login', 'Auth\LoginController@adminLogin');
      Route::get('/register', 'Auth\RegisterController@showAdminRegisterForm');
      Route::post('/register', 'Auth\RegisterController@createAdmin');
  });
  
  Route::prefix('manager')-&gt;group(function () {
      Route::get('/login', 'Auth\LoginController@showManagerLoginForm');
      Route::post('/login', 'Auth\LoginController@managerLogin');
      Route::get('/register', 'Auth\RegisterController@showManagerRegisterForm');
      Route::post('/register', 'Auth\RegisterController@createManager');
  });
  
  Route::prefix('vendor')-&gt;group(function () {
      Route::get('/login', 'Auth\LoginController@showVendorLoginForm');
      Route::post('/login', 'Auth\LoginController@vendorLogin');
      Route::get('/register', 'Auth\RegisterController@showVendorRegisterForm');
      Route::post('/register', 'Auth\RegisterController@createVendor');
  });
  
  
  Route::view('/home', 'home')-&gt;middleware('auth');
  
  Route::get('/admin', 'AdminController@dashboard');
  Route::get('/manager', 'ManagerController@dashboard');
  Route::get('/vendor', 'VendorController@dashboard');
  </code></pre>
  
  <p><strong>RedirectIfAuthenticated.php</strong></p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Middleware;
  
  use Closure;
  use Illuminate\Support\Facades\Auth;
  
  class RedirectIfAuthenticated
  {
      public function handle($request, Closure $next, $guard = null)
      {
          if ($guard == "admin" &amp;&amp; Auth::guard($guard)-&gt;check()) {
                  return redirect('/admin');
          }
          if ($guard == "manager" &amp;&amp; Auth::guard($guard)-&gt;check()) {
              return redirect('/manager');
          }
          if ($guard == "vendor" &amp;&amp; Auth::guard($guard)-&gt;check()) {
              return redirect('/vendor');
          }
          if (Auth::guard($guard)-&gt;check()) {
              return redirect('/home');
          }
  
          return $next($request);
      }
  }
  </code></pre>
  
  <p><strong>config.auth.php</strong></p>
  
  <pre><code>&lt;?php
  
  return [
  
      'defaults' =&gt; [
          'guard' =&gt; 'admin',
          'passwords' =&gt; 'admins',
      ],
  
  
      'guards' =&gt; [
  
          'admin' =&gt; [
              'driver' =&gt; 'session',
              'provider' =&gt; 'admins',
          ],
  
          'manager' =&gt; [
              'driver' =&gt; 'session',
              'provider' =&gt; 'managers',
          ],
  
          'vendor' =&gt; [
              'driver' =&gt; 'session',
              'provider' =&gt; 'vendors',
          ],
  
          'api' =&gt; [
              'driver' =&gt; 'token',
              'provider' =&gt; 'users',
              'hash' =&gt; false,
          ],
      ],
  
      'providers' =&gt; [
  
          'admins' =&gt; [
              'driver' =&gt; 'eloquent',
              'model' =&gt; App\Admin::class,
          ],
  
          'managers' =&gt; [
              'driver' =&gt; 'eloquent',
              'model' =&gt; App\Manager::class,
          ],
  
  
          'vendors' =&gt; [
              'driver' =&gt; 'eloquent',
              'model' =&gt; App\Vendor::class,
          ],
      ],
  
      'passwords' =&gt; [
          'admins' =&gt; [
              'provider' =&gt; 'admins',
              'table' =&gt; 'password_resets',
              'expire' =&gt; 60,
          ],
          'managers' =&gt; [
              'provider' =&gt; 'managers',
              'table' =&gt; 'password_resets',
              'expire' =&gt; 60,
          ],
          'vendors' =&gt; [
              'provider' =&gt; 'vendors',
              'table' =&gt; 'password_resets',
              'expire' =&gt; 60,
          ],
      ],
  
  ];
  </code></pre>
  
  <p>When I am trying to get the Auth::user() by doing dd() at AdminController, it shows me null because of multi-auth. Though it logged in successfully. I assume I am not using proper guard for the admin. But at the same time I have no clue how to fix this. Please help me out.</p>