mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 17:44:04 +00:00
Minor refactor
This commit is contained in:
parent
7ce9613a68
commit
e919c6e25b
1 changed files with 13 additions and 8 deletions
|
|
@ -22,14 +22,14 @@ class TenantManager
|
|||
*
|
||||
* @var StorageDriver
|
||||
*/
|
||||
public $storage;
|
||||
private $storage;
|
||||
|
||||
/**
|
||||
* Database manager.
|
||||
*
|
||||
* @var DatabaseManager
|
||||
*/
|
||||
public $database;
|
||||
private $database;
|
||||
|
||||
/**
|
||||
* Current tenant.
|
||||
|
|
@ -225,13 +225,18 @@ class TenantManager
|
|||
*/
|
||||
public function put($key, $value = null, string $uuid = null)
|
||||
{
|
||||
$uuid = $uuid ?: $this->tenant['uuid'];
|
||||
|
||||
// If $uuid is the uuid of the current tenant, put
|
||||
// the value into the $this->tenant array as well.
|
||||
$target = []; // black hole
|
||||
if (($this->tenant['uuid'] ?? null) === $uuid) {
|
||||
if (is_null($uuid)) {
|
||||
if (! isset($this->tenant['uuid'])) {
|
||||
throw new \Exception("No UUID supplied (and no tenant is currently identified).");
|
||||
}
|
||||
|
||||
$uuid = $this->tenant['uuid'];
|
||||
|
||||
// If $uuid is the uuid of the current tenant, put
|
||||
// the value into the $this->tenant array as well.
|
||||
$target = &$this->tenant;
|
||||
} else {
|
||||
$target = []; // black hole
|
||||
}
|
||||
|
||||
if (! is_null($value)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue