Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

YogyaWebId's avatar

I use Laravel 5.2 and I try this and work!

protected function authenticated(Request $request, User $user) {

    if(\Auth::user() && $request->user()->role == 'admin'){
       
        $this->redirectPath='/dashboard';
        return redirect('dashboard');
    }elseif(\Auth::user() && $request->user()->role == 'user'){
       
        $this->redirectPath='/userdashboard';
        return redirect('userdashboard');
    }else{
       
        $this->redirectPath='/';
        return redirect('/');
    }

}

Snapey's avatar

@hondaman900

Never edit anything in the Vendor folder. Next time you upgrade your HACK will be blown away and you will be clueless why your app no longer works as expected.

Previous

Please or to participate in this conversation.