mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 18:44:03 +00:00
Bugfix
put() stored the value for the current tenant even if the specified $uuid was of a different tenant
This commit is contained in:
parent
e8f2e62645
commit
2d12a6f05f
1 changed files with 9 additions and 2 deletions
|
|
@ -227,15 +227,22 @@ class TenantManager
|
|||
{
|
||||
$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 = [];
|
||||
if (($this->tenant['uuid'] ?? null) === $uuid) {
|
||||
$target = &$this->tenant;
|
||||
}
|
||||
|
||||
if (! is_null($value)) {
|
||||
return $this->tenant[$key] = $this->storage->put($uuid, $key, $value);
|
||||
return $target[$key] = $this->storage->put($uuid, $key, $value);
|
||||
}
|
||||
|
||||
if (! is_array($key)) {
|
||||
throw new \Exception("No value supplied for key $key.");
|
||||
}
|
||||
|
||||
return $this->tenant[$key] = $this->storage->putMany($uuid, $key);
|
||||
return $target[$key] = $this->storage->putMany($uuid, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue