1 week ago by Sean brogan

Relates to the lesson Roles and permissions in Laravel

Hi I have watched the users roles and permissions course and found it very useful but I am stuck on how to assign users within a company allow them to only work within the companies data. I have seen the word multi-tenancy thrown around online to describe the sort of relationship but I am still unsure where to start.

eg. Superadmin - controls all companies Company admin - controls one company Company editor - makes edits to their companies data Company customers - belongs to a company uses the system within the companies data. Cant be seen by other companies.

This seems to be a popular type of relationship for CRMs and other SAAS products but I cant find tutorials anywhere n how to set these up. Any help or advice on where to start would be great.

1 week ago by Kristian Kjornes

You could either have a direct relationship within the roles table to the company table like

Roles.CompanyId = Company.Id

Or you could have a another table that combines them like so

RolesCompany.RoleId = Roles.Id, RolesCompany.CompanyId = Company.Id

Sign in or create an account to reply to this topic.