DEV Community

AjayMalhotra
AjayMalhotra

Posted on

Laravel - redirect user based on usertype

https://therichpost.com/laravel-7-how-to-redirect-authenticated-users-based-on-user-type/

Thank you

Top comments (1)

Collapse
 
auniik profile image
Auniik Datta
protected function authenticated(Request $request) { return redirect( [ 'admin' => '/admin/dashboard/', 'superadmin' => '/superadmin/dashboard/' ][ auth()->user()->userType ] ); } 

How's that ?