1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 16:54:05 +00:00

Make with-pending default to config('tenancy.pending.include_in_queries') in HasTenantOptions

This commit is contained in:
lukinovec 2022-09-30 10:19:31 +02:00
parent bd8a1aa2ce
commit 7a0eaeb007

View file

@ -16,7 +16,7 @@ trait HasTenantOptions
{
return array_merge([
['tenants', null, InputOption::VALUE_IS_ARRAY|InputOption::VALUE_OPTIONAL, '', null],
['with-pending', null, InputOption::VALUE_NONE, 'include pending tenants in query', null],
['with-pending', null, InputOption::VALUE_OPTIONAL, 'include pending tenants in query', config('tenancy.pending.include_in_queries')],
], parent::getOptions());
}
@ -27,7 +27,7 @@ trait HasTenantOptions
->when($this->option('tenants'), function ($query) {
$query->whereIn(tenancy()->model()->getTenantKeyName(), $this->option('tenants'));
})
->when(! is_null($this->option('with-pending')) && tenancy()->model()::hasGlobalScope(PendingScope::class), function ($query) {
->when(tenancy()->model()::hasGlobalScope(PendingScope::class), function ($query) {
$query->withPending($this->option('with-pending'));
})
->cursor();