TenantManager
final class TenantManager (View source)
Traits
Properties
protected callable[][] | $listeners | Event listeners. |
from TenantManagerEvents |
protected callable[][] | $integrationListeners | Integration listeners. |
from TenantManagerEvents |
$originalSettings | from BootstrapsTenancy | ||
bool | $initialized | Was tenancy initialized/bootstrapped? |
from BootstrapsTenancy |
protected Application | $app | The application instance. |
|
StorageDriver | $storage | Storage driver for tenant metadata. |
|
DatabaseManager | $database | Database manager. |
|
protected UniqueIdentifierGenerator | $generator | Unique identifier generator. |
|
array | $tenant | Current tenant. |
Methods
Register a listener that will be executed before tenancy is bootstrapped.
Register a listener that will be executed after tenancy is bootstrapped.
Register a listener that will be executed before tenancy is ended.
Register a listener that will be executed after tenancy is ended.
Register a callback for an integration event.
Return callbacks for an integration event.
No description
No description
No description
Create a tenant.
No description
No description
Return an array with information about a tenant based on his uuid.
Alias for getTenantById().
Get tenant uuid based on the domain that belongs to him.
Alias for getTenantIdByDomain().
Get tenant information based on his domain.
No description
No description
Set the tenant property to a JSON decoded version of the tenant's data obtained from storage.
Reconnects to the default database.
Get all tenants.
Initialize tenancy based on tenant uuid.
Get a value from the storage for a tenant.
Puts a value into the storage for a tenant.
Alias for put().
No description
No description
Return the identified tenant's attribute(s).
Details
TenantManagerEvents
bootstrapping(callable $callback)
Register a listener that will be executed before tenancy is bootstrapped.
TenantManagerEvents
bootstrapped(callable $callback)
Register a listener that will be executed after tenancy is bootstrapped.
TenantManagerEvents
ending(callable $callback)
Register a listener that will be executed before tenancy is ended.
TenantManagerEvents
ended(callable $callback)
Register a listener that will be executed after tenancy is ended.
Collection
event(string $name)
Fire an event.
void
integrationEvent(string $name, callable $callback)
Register a callback for an integration event.
callable[]
integration(string $name, ...$arguments)
Return callbacks for an integration event.
bootstrap()
No description
end()
No description
switchDatabaseConnection()
No description
setPhpRedisPrefix($connections = ['default'])
No description
resetPhpRedisPrefix($connections = ['default'])
No description
tagCache()
No description
untagCache()
No description
suffixFilesystemRootPaths()
No description
resetFilesystemRootPaths()
No description
__construct(Application $app, StorageDriver $storage, DatabaseManager $database, UniqueIdentifierGenerator $generator)
No description
array
init(string $domain = null)
No description
array
identify(string $domain = null)
No description
array
create(string $domain = null, array $data = [])
Create a tenant.
generateUniqueIdentifier(string $domain, array $data)
No description
bool
delete(string $uuid)
No description
array
getTenantById(string $uuid, array|string $fields = [])
Return an array with information about a tenant based on his uuid.
array
find(string $uuid, array|string $fields = [])
Alias for getTenantById().
string|null
getTenantIdByDomain(string $domain = null)
Get tenant uuid based on the domain that belongs to him.
string|null
getIdByDomain(string $domain = null)
Alias for getTenantIdByDomain().
array
findByDomain(string $domain = null, mixed $fields = [])
Get tenant information based on his domain.
static string|null
currentDomain()
No description
string
getDatabaseName($tenant = [])
No description
array
setTenant(array $tenant)
Set the tenant property to a JSON decoded version of the tenant's data obtained from storage.
void
disconnectDatabase()
Reconnects to the default database.
Collection
all(array|string $uuids = [])
Get all tenants.
array
initById(string $uuid)
Initialize tenancy based on tenant uuid.
mixed
get(string|array $key, string $uuid = null)
Get a value from the storage for a tenant.
mixed
put(string|array $key, mixed $value = null, string $uuid = null)
Puts a value into the storage for a tenant.
mixed
set(string|array $key, mixed $value = null, string $uuid = null)
Alias for put().
protected
jsonDecodeArrayValues(array $array)
No description
useJson()
No description
mixed
__invoke(string $attribute)
Return the identified tenant's attribute(s).