Changeset View
Changeset View
Standalone View
Standalone View
src/app/Observers/DomainObserver.php
Show All 30 Lines | class DomainObserver | ||||
public function created(Domain $domain) | public function created(Domain $domain) | ||||
{ | { | ||||
// Create domain record in LDAP | // Create domain record in LDAP | ||||
// Note: DomainCreate job will dispatch DomainVerify job | // Note: DomainCreate job will dispatch DomainVerify job | ||||
\App\Jobs\Domain\CreateJob::dispatch($domain->id); | \App\Jobs\Domain\CreateJob::dispatch($domain->id); | ||||
} | } | ||||
/** | /** | ||||
* Handle the domain "deleting" event. | |||||
* | |||||
* @param \App\Domain $domain The domain. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function deleting(Domain $domain) | |||||
{ | |||||
// Entitlements do not have referential integrity on the entitled object, so this is our | |||||
// way of doing an onDelete('cascade') without the foreign key. | |||||
\App\Entitlement::where('entitleable_id', $domain->id) | |||||
->where('entitleable_type', Domain::class) | |||||
->delete(); | |||||
} | |||||
/** | |||||
* Handle the domain "deleted" event. | * Handle the domain "deleted" event. | ||||
* | * | ||||
* @param \App\Domain $domain The domain. | * @param \App\Domain $domain The domain. | ||||
* | * | ||||
* @return void | * @return void | ||||
*/ | */ | ||||
public function deleted(Domain $domain) | public function deleted(Domain $domain) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | class DomainObserver | ||||
* Handle the domain "restored" event. | * Handle the domain "restored" event. | ||||
* | * | ||||
* @param \App\Domain $domain The domain. | * @param \App\Domain $domain The domain. | ||||
* | * | ||||
* @return void | * @return void | ||||
*/ | */ | ||||
public function restored(Domain $domain) | public function restored(Domain $domain) | ||||
{ | { | ||||
// Restore domain entitlements | |||||
\App\Entitlement::restoreEntitlementsFor($domain); | |||||
// Create the domain in LDAP again | // Create the domain in LDAP again | ||||
\App\Jobs\Domain\CreateJob::dispatch($domain->id); | \App\Jobs\Domain\CreateJob::dispatch($domain->id); | ||||
} | } | ||||
/** | |||||
* Handle the domain "force deleted" event. | |||||
* | |||||
* @param \App\Domain $domain The domain. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function forceDeleted(Domain $domain) | |||||
{ | |||||
// | |||||
} | |||||
} | } |