laravel 5根据用户角色在登录后重定向用户 [英] laravel 5 redirect user after login based on user's role
本文介绍了laravel 5根据用户角色在登录后重定向用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的用户"表有一个角色"列,当用户注册或登录时,我希望根据他们的角色列对他们进行重定向.我该怎么办?
My 'users' table has a 'role' column and when users are registered or logged in, I want them to be redirected based on their role column. how can I do that?
推荐答案
我将此功能添加到了AuthController.php中,并且一切都神奇地修复了
I added this function to AuthController.php and everything fixed magically
public function authenticated($request , $user){
if($user->role=='super_admin'){
return redirect()->route('admin.dashboard') ;
}elseif($user->role=='brand_manager'){
return redirect()->route('brands.dashboard') ;
}
}
这篇关于laravel 5根据用户角色在登录后重定向用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文