Raydium Framework

TenantSetup
in package

Table of Contents

$apiConfig  : mixed
$configs  : mixed
$dbTenants  : array<string|int, mixed>
$kioskConfig  : mixed
$services  : mixed
$tenant  : array<string|int, mixed>|null
$tenantResolver  : TenantResolver|null
__construct()  : mixed
createTenantResolver()  : TenantResolver
Create a tenant resolver with the given tenants.
getCurrentTenant()  : null|array<string|int, mixed>
Get the current tenant.
getDBPrefix()  : null|string
Determines the database prefix for the tenant.
isAppAPI()  : bool
Check if the given tenant domain represents an API request.
isKiosk()  : bool
Check if the given tenant domain represents a kiosk.
isLandlord()  : bool
Checks if the provided tenant ID matches the landlord's UUID.
resolveTenantFromRequest()  : array<string|int, mixed>
Resolve tenant information from the incoming request.
setCurrentTenant()  : null|array<string|int, mixed>
Set the current tenant for the application.
createApiTenant()  : array<string|int, mixed>
Create an API tenant configuration.
createKioskTenant()  : array<string|int, mixed>
Create a kiosk tenant configuration.
isValidTenantId()  : bool
Validate if the given string is a valid tenant ID.

Properties

$dbTenants

private array<string|int, mixed> $dbTenants = []

$tenant

private array<string|int, mixed>|null $tenant = null

Methods

__construct()

public __construct(mixed $configs, mixed $services) : mixed
Parameters
$configs : mixed
$services : mixed
Return values
mixed

createTenantResolver()

Create a tenant resolver with the given tenants.

public createTenantResolver(array<string|int, mixed> $tenants) : TenantResolver
Parameters
$tenants : array<string|int, mixed>
Return values
TenantResolver

getCurrentTenant()

Get the current tenant.

public getCurrentTenant() : null|array<string|int, mixed>
Return values
null|array<string|int, mixed>

getDBPrefix()

Determines the database prefix for the tenant.

public getDBPrefix(string $tenantId) : null|string
Parameters
$tenantId : string

Tenant's UUID.

Return values
null|string

Database prefix or null if not the main site.

isAppAPI()

Check if the given tenant domain represents an API request.

public isAppAPI(array<string|int, mixed> $tenantDomain) : bool
Parameters
$tenantDomain : array<string|int, mixed>
Return values
bool

isKiosk()

Check if the given tenant domain represents a kiosk.

public isKiosk(array<string|int, mixed> $tenantDomain) : bool
Parameters
$tenantDomain : array<string|int, mixed>
Return values
bool

isLandlord()

Checks if the provided tenant ID matches the landlord's UUID.

public static isLandlord([null|string $tenantId = null ]) : bool
Parameters
$tenantId : null|string = null

The tenant ID to check against the landlord's UUID.

Return values
bool

True if the tenant ID matches the landlord's UUID, false otherwise.

resolveTenantFromRequest()

Resolve tenant information from the incoming request.

public resolveTenantFromRequest(ServerRequestInterface $request) : array<string|int, mixed>
Parameters
$request : ServerRequestInterface
Return values
array<string|int, mixed>

setCurrentTenant()

Set the current tenant for the application.

public setCurrentTenant([null|array<string|int, mixed> $tenant = null ][, array<string|int, mixed> $tenantDomain = [] ][, bool $isAdminKiosk = false ][, bool $isApiRequest = false ]) : null|array<string|int, mixed>
Parameters
$tenant : null|array<string|int, mixed> = null

Optional tenant data to directly set.

$tenantDomain : array<string|int, mixed> = []

The resolved tenant domain information.

$isAdminKiosk : bool = false

Whether this is an admin kiosk request.

$isApiRequest : bool = false

Whether this is an API request.

Tags
throws
Exception

If tenant cannot be resolved.

Return values
null|array<string|int, mixed>

The resolved tenant.

createApiTenant()

Create an API tenant configuration.

private createApiTenant() : array<string|int, mixed>
Tags
psalm-return

array{id: mixed, uuid: mixed, enabled: mixed, framework: mixed}

Return values
array<string|int, mixed>

createKioskTenant()

Create a kiosk tenant configuration.

private createKioskTenant() : array<string|int, mixed>
Tags
psalm-return

array{id: mixed, uuid: mixed, enabled: mixed, framework: mixed}

Return values
array<string|int, mixed>

isValidTenantId()

Validate if the given string is a valid tenant ID.

private isValidTenantId(string $tenantId) : bool

Implement this method based on your validation rules.

Parameters
$tenantId : string
Return values
bool

Search results