1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-13 19:04:03 +00:00

WIP DatabaseManager

This commit is contained in:
Samuel Štancl 2019-09-08 13:46:07 +02:00
parent ab0a40a17e
commit 04b4e0644f
7 changed files with 27 additions and 11 deletions

View file

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Stancl\Tenancy;
use Illuminate\Foundation\Application;
use Stancl\Tenancy\Exceptions\NoTenantIdentifiedException;
use Stancl\Tenancy\Exceptions\TenantCouldNotBeIdentifiedException;
/**
@ -41,6 +42,7 @@ class TenantManagerv2
{
// todo make this atomic
$this->storage->createTenant($tenant);
$this->database->create($tenant);
// todo create database, optionally migrate
return $this;
@ -125,6 +127,12 @@ class TenantManagerv2
return $this;
}
/**
* Get the current tenant
*
* @return Tenant
* @throws NoTenantIdentifiedException
*/
public function getTenant(): Tenant
{
if (! $this->tenant) {