Using Spatie's Laravel Permission Package, How Can I Assign Multiple Roles To A User?

- 1 answer

I have many accounts, and many users. A user should have a role of manager in one agency but also a role of customer in another account.

Is it possible to use Spatie's Laravel permissions package ( for this? For example a permission may exists called can delete accounts, but this should only be valid for certain accounts. The default functionality of the package would mean that a user with the permission can delete accounts would allow them to delete ANY account instead of only the account which they are a manager of.

I was thinking to have a many-to-many table users_roles, with fields user_id, role_id, role_name.

Is there any documentation on this? Or anyone accomplished this with the package?



Not out of the box with Spatie's Laravel Permission.

But you can write your own gates in Laravel:

Check your current version docs as it might defer.