Closed eelco2k closed 4 months ago
up
Thank you for your contribution @eelco2k appreciate it.
But i have a question, what goals between the tenancy.is_tenant_aware
and tenancy.enabled
config?
because i think this package is for API purpose, we can use tenancy.enabled
only. Istead of adding a more config.
what i also will do is refactor and not put the trait on the model, but on the handlers. that way you don't have to add the trait manually to the model but it's already configured in the handler stubs.
I will try to reuse:
public static function scopeEloquentQueryToTenant(Builder $query, ?Model $tenant): Builder
and
protected static bool $isScopedToTenant = true;
But because you're using spatie query builder i have to change it a little bit.
what i also will do is refactor and not put the trait on the model, but on the handlers. that way you don't have to add the trait manually to the model but it's already configured in the handler stubs.
I will try to reuse:
public static function scopeEloquentQueryToTenant(Builder $query, ?Model $tenant): Builder and protected static bool $isScopedToTenant = true;
But because you're using spatie query builder i have to change it a little bit.
thats will be great for performance, because the model isnt execute the bootHasApiTenantScope
method anymore if the model used outside of the Handlers.
let merge to dev version first
@eelco2k can you test the dev branch? and please give some screenshot of your test.
Update the composer.json
"rupadana/filament-api-support": "dev-dev"
Thank You.
Added the ability to scope API resources to be Filament tenant aware. By default the tenant-awareness is disabled in the config.