DEV Community

AjayMalhotra
AjayMalhotra

Posted on

1

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 ?

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more