laratrust
laratrust copied to clipboard
create roles based on service_provider_id
Hey,
I have a situation where i have to create roles for every service_provider, every service provider will create their own roles whcih means the name field cannot be unique. roles table will have an sp_id. when creating, fetching or assigning the role there will be a sp_id present. my question is do i have to extend the role model or i can achieve this somehow in the model by adding some sort of where condition. any help would be highly appreciated.
Check out the Teams feature: https://laratrust.santigarcor.me/docs/6.x/usage/teams.html
You can use the teams function as suggested creating a team for each service provider.
Otherwise you can use GUIDs as roles names to be sure they will be unique. Maybe define a support class to create / store a dictionary with the roles / service provider relationships. For instance, you pass a role name and a service provider id and in returns you get the GUID of that specific role.