title: How to redirect intended user to a different route based on their role?
body: <p>I'd like to redirect my user to different route, based on their role. I have two secured area in my app, "admin" and "dashboard". I'd like to check if user is authenticated, then redirect to intended, but if user has role editor it should be redirected to dashboard, otherwise if he has role admin should be redirected to admin area.</p>
  
  <p>I'm using AuthenticatesAndRegistersUsers class in my login. I have this on my custom controller:</p>
  
  <pre><code> /**
   * The default redirecTo path.
   *
   */
   protected $redirectTo = '/dashboard';
  </code></pre>
  
  <p>So when a user is authenticated it will be redirected to dashboard, but I'd like to check if the intended url is on admin group route and if user has admin role it should be redirected to admin area.</p>
  
  <p>I'm using this middleware to redirect to login:</p>
  
  <pre><code>public function handle($request, Closure $next)
  {
      if ($this-&gt;auth-&gt;guest())
      {
          if ($request-&gt;ajax())
          {
              return response('Unauthorized.', 401);
          }
          else
          {
              return redirect()-&gt;guest('auth/login');
          }
      }
  
      return $next($request);
  }
  </code></pre>