DEV Community

Discussion on: Laravel 8 Auth (Registration and Login)

Collapse
 
anisahmmed profile image
Anis Ahamed

. I have used this way but it's not working. Is there any way to redirect user by using middleware

public function redirectTo()
{
$role = Auth::user()->role_id;
switch ($role) {
case '1':
return redirect(route('dashboard'));
break;
case '2':
return redirect(route('judge_dashboard'));
case '3':
return redirect(route('user_dashboard'));
default:
return '/login';
break;
}
}

Thread Thread
 
kingsconsult profile image
Kingsconsult

Hello, sorry I missed your comment, have you resolved it? you can still reach out to me, if you have not