From 4d7831d6f6a172760dd54f64e527ea9895768e02 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Fri, 22 Jul 2022 15:44:19 +0200 Subject: [PATCH] Improve getTenants condition --- src/Concerns/HasTenantOptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Concerns/HasTenantOptions.php b/src/Concerns/HasTenantOptions.php index a4e6d929..a9df1a0e 100644 --- a/src/Concerns/HasTenantOptions.php +++ b/src/Concerns/HasTenantOptions.php @@ -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();