F
Filament16mo ago
Wiebe

Ignore tenant on certain resources

It it possible to ignore the tenant on certain resources?
4 Replies
Patrick Boivin
Patrick Boivin16mo ago
I'm not sure. Just out of curiosity, do you have a single or multiple panels? I'm thinking a simple solution could be to put the shared resources in a separate panel.
hwapx
hwapx16mo ago
Same question. Looking at the code, my first impression is that it's currently not possible. Sadly multiple panels isn't the best solution. Some resources belong to the same "panel domain" and must be readable by all users, while only "Super Admins" can write to it. Other resources are read only for all and only writable by automated scripts, like the list of cities or the list of tenants/partners that should be readable for all users without filtering by tenancy. While it don't looks correcly to me. I'm solving the problem overriding the method scopeEloquentQueryToTenant and returning the query without changes
public static function scopeEloquentQueryToTenant(Builder $query, ?\Illuminate\Database\Eloquent\Model $tenant): Builder
{
return $query;
}
public static function scopeEloquentQueryToTenant(Builder $query, ?\Illuminate\Database\Eloquent\Model $tenant): Builder
{
return $query;
}
Patrick Boivin
Patrick Boivin16mo ago
Nice! I think there are other tenant-aware parts in the resource though, did you run into any other issues?
hwapx
hwapx16mo ago
So far no issues
Want results from more Discord servers?
Add your server