mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-04 21:14:02 +00:00
final changes
This commit is contained in:
parent
405e3148bd
commit
ac5c63ffc6
3 changed files with 5 additions and 5 deletions
|
|
@ -12,7 +12,7 @@ class DatabaseStorageDriver implements StorageDriver
|
||||||
// todo use an instance of tenant model?
|
// todo use an instance of tenant model?
|
||||||
// todo write tests verifying that data is decoded and added to the array
|
// 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);
|
$id = $this->getTenantIdByDomain($domain);
|
||||||
if (! $id) {
|
if (! $id) {
|
||||||
|
|
|
||||||
|
|
@ -70,9 +70,9 @@ class Tenant extends Model
|
||||||
|
|
||||||
public function getFromData(string $key)
|
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)
|
public function get(string $key)
|
||||||
|
|
|
||||||
|
|
@ -274,7 +274,7 @@ final class TenantManager
|
||||||
$uuid = $uuid ?: $this->tenant['uuid'];
|
$uuid = $uuid ?: $this->tenant['uuid'];
|
||||||
|
|
||||||
if (\is_array($key)) {
|
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);
|
return json_decode($this->storage->get($uuid, $key), true);
|
||||||
|
|
@ -326,7 +326,7 @@ final class TenantManager
|
||||||
$key[$k] = json_encode($v);
|
$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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue