Changeset View
Changeset View
Standalone View
Standalone View
src/app/Observers/DomainObserver.php
<?php | <?php | ||||
namespace App\Observers; | namespace App\Observers; | ||||
use App\Domain; | use App\Domain; | ||||
use Illuminate\Support\Facades\DB; | use Illuminate\Support\Facades\DB; | ||||
class DomainObserver | 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) | public function creating(Domain $domain): void | ||||
{ | { | ||||
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; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 82 Lines • Show Last 20 Lines |