Changeset View
Changeset View
Standalone View
Standalone View
src/app/Observers/UserObserver.php
Show All 14 Lines | class UserObserver | ||||
* Ensure that the user is created with a random, large integer. | * Ensure that the user is created with a random, large integer. | ||||
* | * | ||||
* @param \App\User $user The user being created. | * @param \App\User $user The user being created. | ||||
* | * | ||||
* @return void | * @return void | ||||
*/ | */ | ||||
public function creating(User $user) | public function creating(User $user) | ||||
{ | { | ||||
if (!$user->id) { | |||||
while (true) { | while (true) { | ||||
$allegedly_unique = \App\Utils::uuidInt(); | $allegedly_unique = \App\Utils::uuidInt(); | ||||
if (!User::find($allegedly_unique)) { | if (!User::find($allegedly_unique)) { | ||||
$user->{$user->getKeyName()} = $allegedly_unique; | $user->{$user->getKeyName()} = $allegedly_unique; | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
// only users that are not imported get the benefit of the doubt. | |||||
$user->status |= User::STATUS_NEW | User::STATUS_ACTIVE; | $user->status |= User::STATUS_NEW | User::STATUS_ACTIVE; | ||||
machniak: As already mentioned in another place. I'd like this line out of the if statement. We mark all… | |||||
} | |||||
// can't dispatch job here because it'll fail serialization | // can't dispatch job here because it'll fail serialization | ||||
} | } | ||||
/** | /** | ||||
* Handle the "created" event. | * Handle the "created" event. | ||||
* | * | ||||
* Ensures the user has at least one wallet. | * Ensures the user has at least one wallet. | ||||
▲ Show 20 Lines • Show All 125 Lines • Show Last 20 Lines |
As already mentioned in another place. I'd like this line out of the if statement. We mark all users with NEW+ACTIVE, I see no reason to make imported users not in sync with the rest.