diff --git a/src/StorageDrivers/DatabaseStorageDriver.php b/src/StorageDrivers/DatabaseStorageDriver.php index 4a75b079..faaa9f16 100644 --- a/src/StorageDrivers/DatabaseStorageDriver.php +++ b/src/StorageDrivers/DatabaseStorageDriver.php @@ -12,7 +12,7 @@ class DatabaseStorageDriver implements StorageDriver // todo use an instance of tenant model? // todo write tests verifying that data is decoded and added to the array - public function identifyTenant(string $domain): array // todo returns data col + public function identifyTenant(string $domain): array { $id = $this->getTenantIdByDomain($domain); if (! $id) { diff --git a/src/Tenant.php b/src/Tenant.php index 50b0bc27..2eb8039f 100644 --- a/src/Tenant.php +++ b/src/Tenant.php @@ -70,9 +70,9 @@ class Tenant extends Model public function getFromData(string $key) { - $this->dataObject = $this->dataObject ?? json_decode($this->{$this->dataColumn()}); + $this->dataArray = $this->dataArray ?? json_decode($this->{$this->dataColumn()}, true); - return $this->dataObject->$key; + return $this->dataArray[$key] ?? null; } public function get(string $key) diff --git a/src/TenantManager.php b/src/TenantManager.php index 5f75d918..37c9e716 100644 --- a/src/TenantManager.php +++ b/src/TenantManager.php @@ -274,7 +274,7 @@ final class TenantManager $uuid = $uuid ?: $this->tenant['uuid']; if (\is_array($key)) { - return $this->jsonDecodeArrayValues($this->storage->getMany($uuid, $key)); // todo is this correct? + return $this->jsonDecodeArrayValues($this->storage->getMany($uuid, $key)); } return json_decode($this->storage->get($uuid, $key), true); @@ -326,7 +326,7 @@ final class TenantManager $key[$k] = json_encode($v); } - return $this->jsonDecodeArrayValues($this->storage->putMany($uuid, $key)); // todo is this correct? + return $this->jsonDecodeArrayValues($this->storage->putMany($uuid, $key)); } /**