From 299437a3c3df5aa6099a1feaea4361512625f0db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Sat, 10 Aug 2019 09:47:48 +0200 Subject: [PATCH] set the storage driver --- src/TenantManager.php | 15 +++++++++++++++ tests/TestCase.php | 2 ++ 2 files changed, 17 insertions(+) diff --git a/src/TenantManager.php b/src/TenantManager.php index afa9e01e..5aa60d0a 100644 --- a/src/TenantManager.php +++ b/src/TenantManager.php @@ -325,4 +325,19 @@ class TenantManager { return $this->storage; } + + /** + * Set the storage driver. + * + * @param Interfaces\StorageDriver|string $driver + * @return void + */ + public function setStorageDriver($driver) + { + if (is_string($driver)) { + $driver = $this->app->make($driver); + } + + $this->storage = $driver; + } } diff --git a/tests/TestCase.php b/tests/TestCase.php index da74d763..39554f0f 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -94,6 +94,8 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase 'database.redis.client' => 'phpredis', 'tenancy.storage_driver' => DatabaseStorageDriver::class, ]); + tenancy()->setStorageDriver(DatabaseStorageDriver::class); + break; case '2': $app['config']->set([