Changeset View
Changeset View
Standalone View
Standalone View
src/app/Console/Commands/UserAddAlias.php
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | public function handle() | ||||
if ($user->aliases()->where('alias', $alias)->first()) { | if ($user->aliases()->where('alias', $alias)->first()) { | ||||
$this->error("Address is already assigned to the user."); | $this->error("Address is already assigned to the user."); | ||||
return 1; | return 1; | ||||
} | } | ||||
$controller = $user->wallet()->owner; | $controller = $user->wallet()->owner; | ||||
// Validate the alias | // Validate the alias | ||||
$error = UsersController::validateEmail($alias, $controller, true); | $error = UsersController::validateAlias($alias, $controller); | ||||
if ($error) { | if ($error) { | ||||
if (!$this->option('force')) { | if (!$this->option('force')) { | ||||
$this->error($error); | $this->error($error); | ||||
return 1; | return 1; | ||||
} | } | ||||
} | } | ||||
$user->aliases()->create(['alias' => $alias]); | $user->aliases()->create(['alias' => $alias]); | ||||
} | } | ||||
} | } |