mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 18:04:03 +00:00
Fix some tests
This commit is contained in:
parent
93d2a281eb
commit
50a77ee826
10 changed files with 76 additions and 61 deletions
|
|
@ -6,7 +6,7 @@ namespace Stancl\Tenancy\Facades;
|
|||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class GlobalCache extends Facade
|
||||
class GlobalCacheFacade extends Facade
|
||||
{
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
|
|
@ -7,7 +7,7 @@ namespace Stancl\Tenancy\Facades;
|
|||
use Illuminate\Support\Facades\Facade;
|
||||
use Stancl\Tenancy\TenantManager;
|
||||
|
||||
class Tenancy extends Facade
|
||||
class TenancyFacade extends Facade
|
||||
{
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
16
src/Facades/TenantFacade.php
Normal file
16
src/Facades/TenantFacade.php
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Stancl\Tenancy\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
use Stancl\Tenancy\Tenant as Tenant;
|
||||
|
||||
class TenantFacade extends Facade
|
||||
{
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return Tenant::class;
|
||||
}
|
||||
}
|
||||
|
|
@ -77,6 +77,11 @@ class Tenant implements ArrayAccess
|
|||
return static::new()->withData($data)->persisted(true);
|
||||
}
|
||||
|
||||
public static function create($domains, array $data = []): self
|
||||
{
|
||||
return static::new()->withDomains((array) $domains)->withData($data)->save();
|
||||
}
|
||||
|
||||
protected function persisted($persisted = null)
|
||||
{
|
||||
if (gettype($persisted) === 'bool') {
|
||||
|
|
@ -132,7 +137,7 @@ class Tenant implements ArrayAccess
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function withData($data): self
|
||||
public function withData(array $data): self
|
||||
{
|
||||
$this->data = $data;
|
||||
|
||||
|
|
@ -234,7 +239,7 @@ class Tenant implements ArrayAccess
|
|||
|
||||
public function put($key, $value = null): self
|
||||
{
|
||||
if ($this->storage->getIdKey() === $key) {
|
||||
if ($key === 'id') {
|
||||
throw new TenantStorageException("The tenant's id can't be changed.");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ if (! \function_exists('tenant')) {
|
|||
if (! is_null($key)) {
|
||||
return app(Tenant::class)->get($key);
|
||||
}
|
||||
|
||||
return app(Tenant::class);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue