diff --git a/src/Tenancy.php b/src/Tenancy.php index 5ab6400d..f96c0a51 100644 --- a/src/Tenancy.php +++ b/src/Tenancy.php @@ -83,6 +83,10 @@ public function run(Tenant $tenant, Closure $callback): mixed $this->initialize($tenant); $result = $callback($tenant); } finally { + if ($result instanceof PendingDispatch) { // #1277 + $result = null; + } + if ($originalTenant) { $this->initialize($originalTenant); } else { @@ -90,10 +94,6 @@ public function run(Tenant $tenant, Closure $callback): mixed } } - if ($result instanceof PendingDispatch) { // #1277 - $result = null; - } - return $result; }