Disable Filament Tenancy Scoping for a Model
Is there any way to disable filament automatic tenancy scoping for a model?
Take this Role model for an example,
Without the newQuery function, it automatically scopes using the
app_tenancy
(from getTenancyScopeName()
). While that is okay for normal use-case, my specific use case was to use global roles (using Shield/laravel-permissions)
Although, I am not sure if this is the most pragmatic way of doing things. RoleResource::scopeToTenant(false)
is not working, so this was the only way I have been able to use to solve my problem.
My solution was in the docs too: https://filamentphp.com/docs/4.x/users/tenancy#tenancy-securitySolution:Jump to solution
I have tried that using
but to no avail. I have been only able to use the
newQuery
to fix it....2 Replies
RoleResource::scopeToTenant(false) is not working, so this was the only way I have been able to use to solve my problem.You can just declare the property on the resource class, right?
Solution
I have tried that using
but to no avail. I have been only able to use the
newQuery
to fix it.
Another fix as well is not to use Filament Shield, and the Filament's global scope would not apply automatically, not sure what's the difference of using the Shield compared to the Spatie permissions package but it works.
Will mark as resolved for now.