1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 15:54:03 +00:00
put() stored the value for the current tenant even if the specified $uuid was of a different tenant
This commit is contained in:
Samuel Štancl 2019-01-22 21:33:41 +01:00
parent e8f2e62645
commit 2d12a6f05f

View file

@ -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);
}
/**