Permission or Rol based in two models #1775
-
Hi guys, i need to implement Role or Permission to grant accions in a controller depending on two models. Example: a person has a rol o permission on one company, but has another rol or permissions in other company. which is the best/correct way to implementen something like this using spatie/permission? Thx. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
As far as I understand, this package does not support scoped roles/permissions. With this package you have to create same role for each company separately (ex: 'editor_company_1', 'editor_company_2') and then check for it. (something like You can also check out alternatives provided in readme. |
Beta Was this translation helpful? Give feedback.
As far as I understand, this package does not support scoped roles/permissions.
With this package you have to create same role for each company separately (ex: 'editor_company_1', 'editor_company_2') and then check for it. (something like
$user->hasRole('editor_company_' . $article->company_id)
)You can also check out alternatives provided in readme.