Skip to content

Commit

Permalink
Update multiple-guards.md
Browse files Browse the repository at this point in the history
It took me a while to figure out, that you have to add `protected array $guard_name = ['web', 'admin'];` in order to allow an user to use roles / permissions from different guards. Especially since it's not a requirement to specify the `$guard_name`.
  • Loading branch information
angelej committed Apr 22, 2024
1 parent da5c8bc commit 941bb92
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/basic-usage/multiple-guards.md
Expand Up @@ -54,7 +54,7 @@ $user->hasPermissionTo('publish articles', 'admin');

## Assigning permissions and roles to guard users

You can use the same core methods to assign permissions and roles to users; just make sure the `guard_name` on the permission or role matches the guard of the user, otherwise a `GuardDoesNotMatch` or `Role/PermissionDoesNotExist` exception will be thrown.
You can use the same core methods to assign permissions and roles to users; just make sure the `guard_name` on the permission or role matches the guard of the user, otherwise a `GuardDoesNotMatch` or `Role/PermissionDoesNotExist` exception will be thrown. If your user is able to consume multiple roles or permissions from different guards; make sure the user's `$guard_name` property or `guardName()` method returns all allowed guards in an array.


## Using blade directives with multiple guards
Expand Down

0 comments on commit 941bb92

Please sign in to comment.