Skip to content

Commit

Permalink
Merge branch 'feature/configure-permission-identifier'
Browse files Browse the repository at this point in the history
  • Loading branch information
bezhanSalleh committed Apr 25, 2023
2 parents 167f978 + 3cf78fe commit 8f02766
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,9 @@ Str::of($resource)
->snake()
->replace('_', '::');
```
So for instance if you have a resource like `App\Filament\Resources\Shop\CategoryResource` then the permission identifier would be `shop::category` and then it would be prefixed with your defined prefixex or what comes default with shield.
So for instance if you have a resource like `App\Filament\Resources\Shop\CategoryResource` then the permission identifier would be `shop::category` and then it would be prefixed with your defined prefixes or what comes default with shield.
If you wish to change the default behaviour, then you can call the static `configurePermissionIdentifierUsing()` method inside a service provider's `boot()` method, to which you pass a Closure to modify the logic. The Closure receives the fully qualified class name as `$resource` which gives you the ability to access any property or method defined within the resource.
If you wish to change the default behaviour, then you can call the static `configurePermissionIdentifierUsing()` method inside a service provider's `boot()` method, to which you pass a Closure to modify the logic. The Closure receives the fully qualified class name of the resource as `$resource` which gives you the ability to access any property or method defined within the resource.
For example, if you wish to use the model name as the permission identifier, you can do it like so:
Expand All @@ -335,7 +335,7 @@ FilamentShield::configurePermissionIdentifierUsing(
);
```
> **Warning**
> Keep in mind that ensuring the uniqueness of the permission identifier is up to you now.
> Keep in mind that ensuring the uniqueness of the permission identifier is now up to you.
#### Pages
Expand Down

0 comments on commit 8f02766

Please sign in to comment.