is there a way to use spatie roles with teams id and filament multenancy on V3 ?
im trying to implement tenancy on v3 using filament multitenancy and also use spatie roles team functionality
https://spatie.be/docs/laravel-permission/v5/basic-usage/teams-permissions
at this point i can use roles and permissions and create the role with the tenant id associated butt i can'tmake it work in the relationship manager
any help will be appreciated ๐
any help will be appreciated ๐
Teams permissions | laravel-permission
laravel-permission
73 Replies
@justjosef hello, here is the post!
What exactly is not working? You're not getting the tenant-specific roles?
@ds_9206 ?
yes
im not having the tenant specific roles when im trying to attach the roles to the model user
even if the role has the teams_id with the team id asociated
+1
Confirmed, same issue with me, the tenant_id isn't included automatically
You have to adapt the queries in the relation manager to only fetch, show, associate (and so on) the roles for the current client by scoping the used queries
Hi, thanks for reply, the problem is not related to scope query, in my case, I can create roles on its CreatePanel, but if I create it using relation manager, an error says :
General error: 1364 Field 'team_id' doesn't have a default value
yeah, because the field/parameter is not set. You have to set it to current team id on creation
but we should not set it since we're already in the right tenant Id, you may check my repository and test it :
https://github.com/aeq-dev/filamentv3-bug-7511
GitHub
GitHub - aeq-dev/filamentv3-bug-7511
Contribute to aeq-dev/filamentv3-bug-7511 development by creating an account on GitHub.
Yes, you are 'in' the right tenant, but how would the relation manager know to set an arbitrary parameter on the model (
team_id
on role
) to the current tenant id?by the same method where we can create role without using relation manager and without setting the team id
How do you do that? In your linked repository, I don't see a RoleResource
In my case it's the package
user belongstomany package
I see, so it's a different question, not about the roles per se