diff --git a/src/Tenancy.php b/src/Tenancy.php index 687dbd6b..03df9767 100644 --- a/src/Tenancy.php +++ b/src/Tenancy.php @@ -93,13 +93,16 @@ class Tenancy */ public function runForMultiple($tenants, callable $callback) { + // Convert null to all tenants + $tenants = is_null($tenants) ? $this->model()->cursor() : $tenants; + // Convert incrementing int ids to strings $tenants = is_int($tenants) ? (string) $tenants : $tenants; // Wrap string in array $tenants = is_string($tenants) ? [$tenants] : $tenants; - // Use all tenants if $tenants is falsy + // Use all tenants if $tenants is falsey $tenants = $tenants ?: $this->model()->cursor(); $originalTenant = $this->tenant; diff --git a/tests/TenantDatabaseManagerTest.php b/tests/TenantDatabaseManagerTest.php index f3f99335..cce09598 100644 --- a/tests/TenantDatabaseManagerTest.php +++ b/tests/TenantDatabaseManagerTest.php @@ -213,4 +213,10 @@ class TenantDatabaseManagerTest extends TestCase $manager->setConnection('mysql2'); $this->assertTrue($manager->databaseExists($name)); } + + /** @test */ + public function path_used_by_sqlite_manager_can_be_customized() + { + + } }