title: Laravel: Multiple auth with same routes
body: <p>I have a Laravel(5.8) application where I have 2 roles <code>Super Admin</code> and <code>Admin</code> which are saved in two different tables <code>admins</code> &amp; <code>users</code>. They each have their own access levels respectively. However, about 95% of the routes in the entire application are same for each of them but restricted or modified according to their access levels.</p>
  <p>For example:<br />
  <code>Admin</code> can only update his own profile and has the permission to Create &amp; View.<br />
  <code>Super Admin</code> can play with the list of <code>admins</code> and has the permission of create/update/view &amp; delete.</p>
  <p>Therefore I have two guards <code>users(default) = users table</code> and <code>admins = admins table</code>. But when I am adding both or the guards in a same controller it just keep redirecting and display that <code>the page is not redirecting properly</code></p>
  <p><strong>config/auth.php</strong></p>
  <pre><code>'guards' =&gt; [
      'web' =&gt; [
          'driver'   =&gt; 'session',
          'provider' =&gt; 'users',
      ],
  
      'member' =&gt; [
          'driver'   =&gt; 'session',
          'provider' =&gt; 'member',
      ],
      ...
  ],
  'providers' =&gt; [
      'users' =&gt; [
          'driver' =&gt; 'eloquent',
          'model'  =&gt; App\User::class,
      ],
  
      'member' =&gt; [
          'driver' =&gt; 'eloquent',
          'model'  =&gt; App\Member::class,
      ],
  ],
  </code></pre>
  <p><strong>User.php</strong></p>
  <pre><code>class User extends Authenticatable
  {
      ...
  
      public function _login($request)
      {
          if(\Auth::attempt([
              'email'    =&gt; $request-&gt;email,
              'password' =&gt; $request-&gt;password
          ]))
          {
              return [
                  'success' =&gt; true
              ];
          }
          else
          {
              return [
                  'success' =&gt; false
              ];
          }
      }
  }
  </code></pre>
  <p><strong>Member.php</strong></p>
  <pre><code>class Member extends Authenticatable
  {
      ...
  
      public function _login($request)
      {
          if(\Auth::guard('member')-&gt;attempt([
              'email'    =&gt; $request-&gt;email,
              'password' =&gt; $request-&gt;password
          ]))
          {
              return [
                  'success' =&gt; true
              ];
          }
          else
          {
              return [
                  'success' =&gt; false
              ];
          }
      }
  }
  </code></pre>
  <p><strong>HomeController.php</strong></p>
  <pre><code>class HomeController extends Controller
  {
      /**
       * Create a new controller instance.
       *
       * @return void
       */
      public function __construct()
      {
          $this-&gt;middleware('auth');
      }
  
      /**
       * Show the application dashboard.
       *
       * @return \Illuminate\Contracts\Support\Renderable
       */
      public function index()
      {
          echo &quot;&lt;pre&gt;&quot;;
  
          if(\Auth::user())
          {
              print_r(\Auth::user());
          }
          else if(\Auth::guard('member')-&gt;user())
          {
              print_r(\Auth::guard('member')-&gt;user());
          }
  
          echo &quot;&lt;/pre&gt;&quot;;
      }
  }
  </code></pre>
  <p>If I comment the <code>auth</code> middleware in the <code>__construct()</code> then it works and displays the data of the logged in user but if keep redirecting and shows <code>the page is not redirecting properly</code> error.</p>