我正在寻找存档以下内容
用户登录 -> 从数据库分配了权限 -> 他们只能看到允许的路由
到目前为止我已经能够到达这里:
$user = Usercredential::where('username','=',Auth::user()->username)->get();
foreach ($user as $u ) {
$status = $u->userstatus;
$userPriv = $u->userpriviledge;
if ($status == 0){
Session::put('user_priv',$userPriv);
}
else{
return Redirect::to_route('home')->with('message','Inactive users cannot login');
}
它检查用户的状态(无论是事件还是非事件),然后将权限存储在我的 session 中。接下来是什么?如何保护我的路线?
谢谢
最佳答案
我向您推荐 Laravel 4 软件包:ENTRUST谁提供了添加基于角色的方法
关于php - Laravel 角色和路由身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16672064/