Changeset View
Changeset View
Standalone View
Standalone View
src/app/Observers/DomainObserver.php
Show All 16 Lines | class DomainObserver | ||||
{ | { | ||||
while (true) { | while (true) { | ||||
$allegedly_unique = \App\Utils::uuidInt(); | $allegedly_unique = \App\Utils::uuidInt(); | ||||
if (!Domain::find($allegedly_unique)) { | if (!Domain::find($allegedly_unique)) { | ||||
$domain->{$domain->getKeyName()} = $allegedly_unique; | $domain->{$domain->getKeyName()} = $allegedly_unique; | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
$domain->status |= Domain::STATUS_NEW; | |||||
} | } | ||||
/** | /** | ||||
* 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 created(Domain $domain) | public function created(Domain $domain) | ||||
{ | { | ||||
\App\Jobs\ProcessDomainCreate::dispatch($domain); | // Create domain record in LDAP, then check if it exists in DNS | ||||
$chain = [ | |||||
new \App\Jobs\ProcessDomainVerify($domain), | |||||
]; | |||||
\App\Jobs\ProcessDomainCreate::withChain($chain)->dispatch($domain); | |||||
} | } | ||||
/** | /** | ||||
* Handle the domain "updated" event. | * Handle the domain "updated" event. | ||||
* | * | ||||
* @param \App\Domain $domain The domain. | * @param \App\Domain $domain The domain. | ||||
* | * | ||||
* @return void | * @return void | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |