We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
这个在控制器中怎么判断权限啊? 是不是根据这个控制器的当然路由来判断是否存在权限. 比如我有一个更新按钮,我点击这个更新按钮,我怎么知道是不是有这个权限呢? 是根据点击 更新按钮的路由来判断吗?那是不是 product.create 应该改成具体的路由名称
The text was updated successfully, but these errors were encountered:
路由和权限并没有直接关系。
只是说,在业务上,如果这个路由需要做权限控制,那么你可以为这个路由配置一个或多个权限点。 至于权限点与路由的命名,可以自己规范。
权限的判断十分灵活,这也是根据的业务逻辑而定的。
如果只需要在路由上做权限控制,可以使用路由中间件:
Route::post('/posts', [ 'uses' => 'Posts@create', 'middleware' => 'rbac:posts.create', ]);
如果需要在其他地方(比如控制器里)做权限判断,可以这样:
// User这个Model必须 use HuangYi\Rbac\RbacTrait $user = \App\User::find($id); $user->hasPermission('posts.create');
Sorry, something went wrong.
No branches or pull requests
这个在控制器中怎么判断权限啊? 是不是根据这个控制器的当然路由来判断是否存在权限.
比如我有一个更新按钮,我点击这个更新按钮,我怎么知道是不是有这个权限呢? 是根据点击
更新按钮的路由来判断吗?那是不是 product.create 应该改成具体的路由名称
The text was updated successfully, but these errors were encountered: