Skip to content

Commit b7e9d2e

Browse files
authored
Merge pull request spatie#1122 from cbernard73/pr-docs-laravel-authorize
Explain using package with laravel's authorize method
2 parents b5ac05e + 2b0dec9 commit b7e9d2e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,10 @@ All these responses are collections of `Spatie\Permission\Models\Permission` obj
550550
If we follow the previous example, the first response will be a collection with the `delete article` permission and
551551
the second will be a collection with the `edit article` permission and the third will contain both.
552552

553+
### NOTE about using permission names in policies
554+
555+
When calling `authorize()` for a policy method, if you have a permission named the same as one of those policy methods, your permission "name" will take precedence and not fire the policy. For this reason it may be wise to avoid naming your permissions the same as the methods in your policy. While you can define your own method names, you can read more about the defaults Laravel offers in Laravel's documentation at https://laravel.com/docs/5.8/authorization#writing-policies
556+
553557
### Using Blade directives
554558
This package also adds Blade directives to verify whether the currently logged in user has all or any of a given list of roles.
555559

0 commit comments

Comments
 (0)