Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2485102
CreateCommand.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
CreateCommand.php
View Options
<?php
namespace
App\Console\Commands\Policy\RateLimit\Whitelist
;
use
App\Console\Command
;
class
CreateCommand
extends
Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected
$signature
=
'policy:ratelimit:whitelist:create {object}'
;
/**
* The console command description.
*
* @var string
*/
protected
$description
=
'Create a ratelimit whitelist entry'
;
/**
* Execute the console command.
*
* @return mixed
*/
public
function
handle
()
{
$object
=
$this
->
argument
(
'object'
);
if
(
strpos
(
$object
,
'@'
)
===
false
)
{
$domain
=
$this
->
getDomain
(
$object
);
if
(!
$domain
)
{
$this
->
error
(
"No such domain {$object}"
);
return
1
;
}
$id
=
$domain
->
id
;
$type
=
\App\Domain
::
class
;
}
else
{
$user
=
$this
->
getUser
(
$object
);
if
(!
$user
)
{
$this
->
error
(
"No such user {$user}"
);
return
1
;
}
$id
=
$user
->
id
;
$type
=
\App\User
::
class
;
}
\App\Policy\RateLimitWhitelist
::
create
(
[
'whitelistable_id'
=>
$id
,
'whitelistable_type'
=>
$type
]
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Nov 20, 10:50 PM (1 d, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
387332
Default Alt Text
CreateCommand.php (1 KB)
Attached To
Mode
R2 kolab
Attached
Detach File
Event Timeline
Log In to Comment