laratrust icon indicating copy to clipboard operation
laratrust copied to clipboard

create roles based on service_provider_id

Open wcaaan opened this issue 2 years ago • 1 comments

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.

wcaaan avatar Jul 13 '21 07:07 wcaaan

Check out the Teams feature: https://laratrust.santigarcor.me/docs/6.x/usage/teams.html

KKSzymanowski avatar Jul 13 '21 11:07 KKSzymanowski

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.

filippotoso avatar Feb 20 '23 21:02 filippotoso