且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Laravel 5.2以管理员身份登录后重定向管理员页面

更新时间:2023-12-03 23:32:16

转到AuthController.php并添加此方法

go to AuthController.php and add this method

其中角色是数据库中定义的用户角色.

where role is the user role as defined in the database.

protected function authenticated($request,$user){
    if($user->role === 'admin'){
        return redirect()->intended('admin'); //redirect to admin panel
    }

    return redirect()->intended('/'); //redirect to standard user homepage
}