title: Laravel 5.3 Login redirect to different pages for multiple users
body: <p>I have Laravel 5.3 with three different types of users. I want them to be redirected to different dashboard pages after logging in. For example:</p>
  <blockquote>
  <p>user -&gt; login -&gt; user-dashboard</p>
  <p>admin -&gt; login -&gt; admin-dashboard</p>
  </blockquote>
  <p>I have created a middleware called <code>CheckRole</code>:</p>
  <pre><code>public function handle($request, Closure $next)
  {
      if($request-&gt;user() === null) {
      return response(&quot;Insufficient Permissions&quot; , 401);
      }
      $actions = $request-&gt;route()-&gt;getAction();
      $roles = isset($actions['roles']) ? $actions['roles'] : null;
  
      if($request-&gt;user()-&gt;hasAnyRole($roles) || !$roles) {
              return $next($request);
          }
      return response(&quot;Insufficient Permissions&quot; , 401);
  
  }
  </code></pre>
  <p><strong>Routes</strong></p>
  <pre><code>Route::group(['middleware' =&gt; ['auth','roles'], 'roles' =&gt; 'Admin'],  function () { 
      // Routes here
  }
  </code></pre>
  <p>Roles are working perfectly.</p>
  <p>Now <code>redirectTo= '';</code> in the <code>LoginContoller</code> points to one view only. I have checked the documentation and I believe this has something to do with guards which have no explanation on how to set it up.</p>
  <p>I have also seen multiauth, but I do not think it is wise to create different tables for different users and hence looking for an alternate answer.</p>
  <p>Any Suggestion would be appreciated.</p>
  <p>My tables are like:</p>
  <pre><code>Table users
  
  id | name | email
  ---------
  1  | John | john@blah.com
  2  | Michael | michael@blah.com
  
  Table roles
  
  id | name
  ---------
  1  | Admin
  2  | PrivilegedMember
  3  | Subscriber
  
  Table user_role
  
  id | user_id | role_id
  ----------------------
  1  |    1    |    1   
  2  |    2    |    2
  </code></pre>
  <p>This might be a duplicate of the below question but the answer provided leaves without explaining multiple redirections.</p>
  <p><a href="https://stackoverflow.com/questions/39543967/multiple-authentication-in-laravel-5-3">Multiple Authentication in Laravel 5.3</a></p>