mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-14 04:14:05 +00:00
Atomic tenant creation
This commit is contained in:
parent
b0d119753d
commit
37567336a5
4 changed files with 68 additions and 3 deletions
|
|
@ -29,4 +29,12 @@ interface StorageDriver
|
|||
* @return Tenant
|
||||
*/
|
||||
public function findByDomain(string $domain): Tenant;
|
||||
|
||||
/**
|
||||
* Check if a tenant can be created.
|
||||
*
|
||||
* @param Tenant $tenant
|
||||
* @return true|TenantCannotBeCreatedException
|
||||
*/
|
||||
public function canCreate(Tenant $tenant);
|
||||
}
|
||||
|
|
|
|||
15
src/Contracts/TenantCannotBeCreatedException.php
Normal file
15
src/Contracts/TenantCannotBeCreatedException.php
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace Stancl\Tenancy\Contracts;
|
||||
|
||||
abstract class TenantCannotBeCreatedException extends \Exception
|
||||
{
|
||||
abstract function reason(): string;
|
||||
|
||||
private $message;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->message = 'Tenant cannot be craeted. Reason: ' . $this->reason();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue