1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-14 01:44:03 +00:00

Tenant-specific connections, some work to get tests running

This commit is contained in:
Samuel Štancl 2019-09-15 17:44:26 +02:00
parent e25a01a997
commit c65b6839ff
13 changed files with 162 additions and 67 deletions

View file

@ -21,6 +21,9 @@ class RedisStorageDriver implements StorageDriver
/** @var Redis */
protected $redis;
/** @var Tenant The default tenant. */
protected $tenant;
public function __construct(Application $app, Redis $redis)
{
$this->app = $app;
@ -34,10 +37,17 @@ class RedisStorageDriver implements StorageDriver
*/
protected function tenant()
{
return $this->app[Tenant::class];
return $this->tenant ?? $this->app[Tenant::class];
}
public function ensureTenantCanBeCreated(Tenant $tenant)
public function withDefaultTenant(Tenant $tenant): self
{
$this->tenant = $tenant;
return $this;
}
public function ensureTenantCanBeCreated(Tenant $tenant): void
{
// todo
}