mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 20:34:03 +00:00
TenantStorageException
This commit is contained in:
parent
5fb11dfc9f
commit
e25a01a997
3 changed files with 10 additions and 5 deletions
|
|
@ -7,6 +7,7 @@ namespace Stancl\Tenancy;
|
|||
use ArrayAccess;
|
||||
use Stancl\Tenancy\Contracts\StorageDriver;
|
||||
use Stancl\Tenancy\Contracts\UniqueIdentifierGenerator;
|
||||
use Stancl\Tenancy\Exceptions\TenantStorageException;
|
||||
|
||||
/**
|
||||
* @internal Class is subject to breaking changes in minor and patch versions.
|
||||
|
|
@ -209,8 +210,9 @@ class Tenant implements ArrayAccess
|
|||
|
||||
public function put($key, $value = null): self
|
||||
{
|
||||
// todo something like if ($this->storage->getIdKey() === $key) throw new Exception("Can't override ID")?
|
||||
// and the responsibility of not overriding domains is up to the storage driver
|
||||
if ($this->storage->getIdKey() === $key) {
|
||||
throw new TenantStorageException("The tenant's id can't be changed.");
|
||||
}
|
||||
|
||||
if (is_array($key)) {
|
||||
$this->storage->putMany($key);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue