Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F120837598
UserAddAlias.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
UserAddAlias.php
View Options
<?php
namespace
App\Console\Commands
;
use
App\Console\Command
;
use
App\Http\Controllers\API\V4\UsersController
;
class
UserAddAlias
extends
Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected
$signature
=
'user:add-alias {--force} {user} {alias}'
;
/**
* The console command description.
*
* @var string
*/
protected
$description
=
'Add an email alias to a user (forcefully)'
;
/**
* Execute the console command.
*
* @return mixed
*/
public
function
handle
()
{
$user
=
$this
->
getUser
(
$this
->
argument
(
'user'
));
if
(!
$user
)
{
return
1
;
}
$alias
=
\strtolower
(
$this
->
argument
(
'alias'
));
// Check if the alias already exists
if
(
$user
->
aliases
()->
where
(
'alias'
,
$alias
)->
first
())
{
$this
->
error
(
"Address is already assigned to the user."
);
return
1
;
}
$controller
=
$user
->
wallet
()->
owner
;
// Validate the alias
$error
=
UsersController
::
validateAlias
(
$alias
,
$controller
);
if
(
$error
)
{
if
(!
$this
->
option
(
'force'
))
{
$this
->
error
(
$error
);
return
1
;
}
}
$user
->
aliases
()->
create
([
'alias'
=>
$alias
]);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Apr 24, 1:47 PM (3 d, 10 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18717600
Default Alt Text
UserAddAlias.php (1 KB)
Attached To
Mode
rK kolab
Attached
Detach File
Event Timeline