Changeset View
Changeset View
Standalone View
Standalone View
src/app/Console/Commands/Policy/RateLimit/Whitelist/ReadCommand.php
- This file was added.
<?php | |||||
namespace App\Console\Commands\Policy\RateLimit\Whitelist; | |||||
use Illuminate\Console\Command; | |||||
class ReadCommand extends Command | |||||
{ | |||||
/** | |||||
* The name and signature of the console command. | |||||
* | |||||
* @var string | |||||
*/ | |||||
protected $signature = 'policy:ratelimit:whitelist:read {filter?}'; | |||||
/** | |||||
* The console command description. | |||||
* | |||||
* @var string | |||||
*/ | |||||
protected $description = 'Read the ratelimit policy whitelist'; | |||||
/** | |||||
* Execute the console command. | |||||
* | |||||
* @return mixed | |||||
*/ | |||||
public function handle() | |||||
{ | |||||
machniak: The constructor can be removed. | |||||
\App\Policy\RateLimitWhitelist::each( | |||||
function ($item) { | |||||
$whitelistable = $item->whitelistable; | |||||
if ($whitelistable instanceof \App\Domain) { | |||||
$this->info("{$item->id}: {$item->whitelistable_type} {$whitelistable->namespace}"); | |||||
} elseif ($whitelistable instanceof \App\User) { | |||||
$this->info("{$item->id}: {$item->whitelistable_type} {$whitelistable->email}"); | |||||
} | |||||
} | |||||
); | |||||
} | |||||
Done Inline ActionsMaybe add orderBy(). machniak: Maybe add orderBy(). | |||||
} | |||||
Done Inline ActionsWhat when $whitelisteable is null? E.g. deleted domain/user. machniak: What when $whitelisteable is null? E.g. deleted domain/user. | |||||
Done Inline ActionsThen the observer should have deleted these, I don't know what the reason would be to display them here. vanmeeuwen: Then the observer should have deleted these, I don't know what the reason would be to display… |
The constructor can be removed.