title: Laravel 6 Error: Page not redirecting to the defined route
body: <p>I've been stuck here for a while. I hope I can clearly explain the issue. I'm trying to have separate pages for admin and user. For that, I have created an admin middleware. Now when I login, it redirects me to the same page either its admin or user. I want it to go to admin dashboard when admin logs in and to the user home when user logs in. I hope the issue is clear.
  Here is the <strong>AdminMiddleware</strong> code:</p>
  
  <pre><code>public function handle($request, Closure $next)
      {
        if(Auth::user()-&gt;user_type == 'admin') //If usertype is admin
      {
         return $next($request);
      }
      else {
          return redirect('home');
      }
      }
  </code></pre>
  
  <p>Here are the <strong>routes</strong> code:</p>
  
  <pre><code>    Route::get('/','HomeController@index');
  //For Admin
  Route::group(['middleware' =&gt; ['auth','admin']], function() {
  
  Route::get('/admin','HomeController@home_page');
  Route::get('/users-list', 'UserController@users_list');
  
  });
  </code></pre>
  
  <p>Here is the <strong>HomeController</strong> code:</p>
  
  <pre><code>public function index()
      {
  return view('home', compact('currantWorkspace'));
  }
  </code></pre>
  
  <p>I've added the Middleware path to <strong>kernel.php</strong> file.</p>
  
  <p>I'll be happy to provide any other details if needed. Any solutions/suggestions will be highly appreciated.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>I've tried this, but still issue.</p>
  
  <pre><code>    protected function redirectTo(){
    if (Auth::user()-&gt;user_type != 'admin') {
      return 'admin';
      //return redirect('/admin');
    }
    else {
      return 'home';
      //return redirect('/');
    }
  
  }
  </code></pre>
  
  <p>I think the <strong>redirectTo</strong> function is not working, or not checking the if/else conditions</p>