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
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?
I'd like the user to be able to select these current tenants or see all of them at once.
is it possible ?
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....
@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?
yes but I haven't found the solution yet
Create a single tenant with say id = 1 , name = 'All'
Then, if users current tenant = 1 then scopetoTenant = false if current_team_id = 1
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.
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.