Multi-tenancy with Shield
Does my roles table have to have a team_id?
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'roles.team_id' in 'where clause'
I would think roles would be the same regardless of the team, so I think I probably have something configured incorrectly.
If I take the team relationship off my role model I get:
So it seems that every single table has to have a team_id
for multi-tenancy?4 Replies
Yes, I think you need a relationship to the tenant for every resource in a Panel with multi-tenancy. You can skip the tenant relationship in other contexts like relation manager, select field, etc.
hmmm...ok, so that means I have to duplicate roles across the tenants if I want to have the same roles? So "user" role for tenant 1 and "user" role for tenant 2, etc?
I'm not sure, I feel like there's a way... I think you could manage the users and roles in a separate panel without tenancy. Or override part of the Role resource to ignore the tenancy. I know others have discussed it on Discord.
Solution
protected static bool $isScopedToTenant = false;