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();