Changeset View
Changeset View
Standalone View
Standalone View
src/app/Observers/DomainObserver.php
Show All 10 Lines | class DomainObserver | ||||
* Handle the domain "created" event. | * Handle the domain "created" event. | ||||
* | * | ||||
* @param \App\Domain $domain The domain. | * @param \App\Domain $domain The domain. | ||||
* | * | ||||
* @return void | * @return void | ||||
*/ | */ | ||||
public function creating(Domain $domain): void | public function creating(Domain $domain): void | ||||
{ | { | ||||
while (true) { | |||||
$allegedly_unique = \App\Utils::uuidInt(); | |||||
if (!Domain::withTrashed()->find($allegedly_unique)) { | |||||
$domain->{$domain->getKeyName()} = $allegedly_unique; | |||||
break; | |||||
} | |||||
} | |||||
$domain->namespace = \strtolower($domain->namespace); | $domain->namespace = \strtolower($domain->namespace); | ||||
$domain->status |= Domain::STATUS_NEW; | $domain->status |= Domain::STATUS_NEW; | ||||
$domain->tenant_id = \config('app.tenant_id'); | $domain->tenant_id = \config('app.tenant_id'); | ||||
} | } | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 125 Lines • Show Last 20 Lines |