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

Merged
merged 2 commits into from
May 31, 2025

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

@drbyte
Copy link
Collaborator

drbyte commented May 31, 2025

Thanks!

@drbyte drbyte merged commit 0cd412d into spatie:main May 31, 2025
39 checks passed
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.

2 participants