Adds the ability to call applyExtraTenantScopes which allows you to modify the query builder.
This is extremely useful for when you need to apply extra logic, for example
where tenant_id = 1 or user_type == 'super_admin'
We found ourself in a situation where our client required a "super user" mode which gave him a separate subdomain to access the application through, and engage with all the tenants.
This posed an issue as when you then view the super users engagement from one of the tentants, as the super user did not exist within their scope, their interactions would never display.
By allowing access to the builder we can modify it when needed for special situations. for example
class User {
use BelongsToTenants;
public function applyExtraTenantScopes($builder, $tenant, $id)
{
$builder->orWhere('users.is_super_user', 1);
}
}
Adds the ability to call
applyExtraTenantScopes
which allows you to modify the query builder.This is extremely useful for when you need to apply extra logic, for example
where tenant_id = 1 or user_type == 'super_admin'
We found ourself in a situation where our client required a "super user" mode which gave him a separate subdomain to access the application through, and engage with all the tenants.
This posed an issue as when you then view the super users engagement from one of the tentants, as the super user did not exist within their scope, their interactions would never display.
By allowing access to the builder we can modify it when needed for special situations. for example