All Tenant

Would it be possible to add an option 'All' in the tenant selector that allows users to view all the resources they have access to, for example: (All, team 1, team 2)?
8 Replies
toeknee
toeknee3mo ago
Well yes/no, you would have to choose not to scope the resource to tenant and instead add a filter to the table with a default of the current tenant?
Becker Maxime
Becker MaximeOP3mo ago
I'd like the user to be able to select these current tenants or see all of them at once. is it possible ?
toeknee
toeknee3mo ago
Of course You can either use the tenant menu ->tenantMenu() so it shows the tenant menu in the left sidebar. Or you have the tenant, in the filters for each resource as a filter....
prouse_
prouse_2mo ago
@Becker Maxime did you manage to solve this in any good way? I assume you wanted an "All" option inside the tenant menu and not in the filters?
Becker Maxime
Becker MaximeOP2mo ago
yes but I haven't found the solution yet
toeknee
toeknee2mo ago
Create a single tenant with say id = 1 , name = 'All' Then, if users current tenant = 1 then scopetoTenant = false if current_team_id = 1
Becker Maxime
Becker MaximeOP2mo ago
This setup doesn’t meet my expectations, as it won’t be restricted to specific tenants. It will see all tenants, whereas what I want is for it to only view all entities associated with its tenants. But otherwise a good idea.
toeknee
toeknee2mo ago
But it can do.... if you have the single tenant, then you can decide if your scoping etc. So you can adjust the tenantscope instead based on this, i.e. auth()->user()->allTenants() <- custom relationship pluck id's and do a whereIn('tenant_id', $ids) Or you just modify the tenant scope, to scope always to current users tenants.
Want results from more Discord servers?
Add your server