Skip to content

Commit fe70ca8

Browse files
authored
Clarify that "super" access requires using Laravel Gate methods
1 parent 631799b commit fe70ca8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

docs/basic-usage/super-admin.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ We strongly recommend that a Super-Admin be handled by setting a global `Gate::b
77

88
Then you can implement the best-practice of primarily using permission-based controls (@can and $user->can, etc) throughout your app, without always having to check for "is this a super-admin" everywhere. **Best not to use role-checking (ie: `hasRole`) (except here in Gate/Policy rules) when you have Super Admin features like this.**
99

10+
NOTE: Using this approach, you can/must call Laravel's standard `can()`, `canAny()`, `cannot()`, etc checks for permission authorization to get a correct Super response. Calls which bypass Laravel's Gate (such as a direct call to `->hasPermissionTo()`) will not go through the Gate, and will not get the Super response.
11+
1012

1113
## `Gate::before`
1214
If you want a "Super Admin" role to respond `true` to all permissions, without needing to assign all those permissions to a role, you can use [Laravel's `Gate::before()` method](https://laravel.com/docs/master/authorization#intercepting-gate-checks). For example:

0 commit comments

Comments
 (0)