From 0442be42dee06413fd767e2c2dfd0b8a7ae89ffb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Wed, 10 Jun 2020 18:31:25 +0200 Subject: [PATCH] Fix runForMultiple() for incrementing tenant ids --- src/Tenancy.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Tenancy.php b/src/Tenancy.php index 40843820..687dbd6b 100644 --- a/src/Tenancy.php +++ b/src/Tenancy.php @@ -93,6 +93,9 @@ class Tenancy */ public function runForMultiple($tenants, callable $callback) { + // Convert incrementing int ids to strings + $tenants = is_int($tenants) ? (string) $tenants : $tenants; + // Wrap string in array $tenants = is_string($tenants) ? [$tenants] : $tenants; @@ -102,7 +105,7 @@ class Tenancy $originalTenant = $this->tenant; foreach ($tenants as $tenant) { - if (is_string($tenant)) { + if (! $tenant instanceof Tenant) { $tenant = $this->find($tenant); }