Skip to content

Commit 36bb367

Browse files
authored
Gate notes
1 parent 0068a21 commit 36bb367

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

docs/basic-usage/direct-permissions.md

+11-6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ HOWEVER, If you have reason to directly assign individual permissions to specifi
1313

1414
## Direct Permissions to Users
1515

16+
### Giving/Revoking direct permissions
17+
1618
A permission can be given to any user:
1719

1820
```php
@@ -37,6 +39,15 @@ Or revoke & add new permissions in one go:
3739
$user->syncPermissions(['edit articles', 'delete articles']);
3840
```
3941

42+
## Checking Direct Permissions
43+
Like all permissions assigned via roles, you can check if a user has a permission by using Laravel's default `can` function. This will also allow you to use Super-Admin features provided by Laravel's Gate:
44+
45+
```php
46+
$user->can('edit articles');
47+
```
48+
49+
NOTE: The following `hasPermissionTo`, `hasAnyPermission`, `hasAllPermissions` functions do not support Super-Admin functionality. Use `can`, `canAny`, `canAll` instead.
50+
4051
You can check if a user has a permission:
4152

4253
```php
@@ -68,9 +79,3 @@ You may also pass integers to lookup by permission id
6879
```php
6980
$user->hasAnyPermission(['edit articles', 1, 5]);
7081
```
71-
72-
Like all permissions assigned via roles, you can check if a user has a permission by using Laravel's default `can` function:
73-
74-
```php
75-
$user->can('edit articles');
76-
```

0 commit comments

Comments
 (0)