title: Laravel Redirect If Authenticated middleware
body: <p>I have three type of users for the application, Each one have its own <code>dashboard</code>. I need a check that adminor any other user cannot see another user dashboard.</p>
  
  <p>There is a middleware <code>RedirectIfAuthenticated</code> : </p>
  
  <pre><code>public function handle($request, Closure $next, $guard = null){
  
      if (Auth::guard($guard)-&gt;check() &amp;&amp; auth()-&gt;user()-&gt;type == 'admin'){
          return redirect('/admin');
      }
  
      if (Auth::guard($guard)-&gt;check() &amp;&amp; auth()-&gt;user()-&gt;type == 'author'){
          return redirect('/author');
      }
  
      if (Auth::guard($guard)-&gt;check() &amp;&amp; auth()-&gt;user()-&gt;type == 'client'){
          return redirect('/client');
      }
  }
  </code></pre>
  
  <p>Its under <code>guest</code> middleware.</p>
  
  <p>The above code seems good to me <strong>but when i tests it, The browser says <code>Too many redirects</code></strong>.</p>
  
  <p>What am i doing wrong, What will be the best way to handle it.</p>