Skip to content

Fix guard_name not used to set default attribute in Role and Permission model #2837

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Ken-vdE
Copy link
Contributor

@Ken-vdE Ken-vdE commented Apr 23, 2025

The Role and Permission model constructors don't use the $guard_name property to set $attributes['guard_name'] (through Guard::getDefaultName() as in all other methods).

Also, I believe the getDefaultGuardName() method and the $guard_name property should also be set in Role and Permission model, not just the User model as per the docs: https://spatie.be/docs/laravel-permission/v6/basic-usage/multiple-guards#content-forcing-use-of-a-single-guard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant