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

Improve getTenants condition

This commit is contained in:
lukinovec 2022-07-22 15:44:19 +02:00
parent 95eb49a3d3
commit 4d7831d6f6

View file

@ -27,7 +27,7 @@ trait HasTenantOptions
->when($this->option('tenants'), function ($query) {
$query->whereIn(tenancy()->model()->getTenantKeyName(), $this->option('tenants'));
})
->when(tenancy()->model()::hasGlobalScope(PendingScope::class), function ($query) {
->when(! is_null($this->option('with-pending')) && tenancy()->model()::hasGlobalScope(PendingScope::class), function ($query) {
$query->withPending($this->option('with-pending'));
})
->cursor();