Changeset View
Changeset View
Standalone View
Standalone View
src/app/Domain.php
Show First 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | class Domain extends Model | ||||
* @return \Illuminate\Database\Eloquent\Relations\MorphOne | * @return \Illuminate\Database\Eloquent\Relations\MorphOne | ||||
*/ | */ | ||||
public function entitlement() | public function entitlement() | ||||
{ | { | ||||
return $this->morphOne('App\Entitlement', 'entitleable'); | return $this->morphOne('App\Entitlement', 'entitleable'); | ||||
} | } | ||||
/** | /** | ||||
* Entitlements for this domain. | |||||
* | |||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany | |||||
*/ | |||||
public function entitlements() | |||||
{ | |||||
return $this->hasMany('App\Entitlement', 'entitleable_id', 'id') | |||||
->where('entitleable_type', Domain::class); | |||||
} | |||||
/** | |||||
* Return list of public+active domain names (for current tenant) | * Return list of public+active domain names (for current tenant) | ||||
*/ | */ | ||||
public static function getPublicDomains(): array | public static function getPublicDomains(): array | ||||
{ | { | ||||
return self::withEnvTenantContext() | return self::withEnvTenantContext() | ||||
->whereRaw(sprintf('(type & %s)', Domain::TYPE_PUBLIC)) | ->whereRaw(sprintf('(type & %s)', Domain::TYPE_PUBLIC)) | ||||
->get(['namespace'])->pluck('namespace')->toArray(); | ->get(['namespace'])->pluck('namespace')->toArray(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 380 Lines • Show Last 20 Lines |