29 lines
637 B
PHP
29 lines
637 B
PHP
<?php
|
|
|
|
namespace Mattitja\BadIpBlocker\Console;
|
|
|
|
use Illuminate\Console\Command;
|
|
use Mattitja\BadIpBlocker\BadIpStore;
|
|
|
|
class RemoveCommand extends Command
|
|
{
|
|
protected $signature = 'bad-ip-blocker:remove {ip : The IP address to unblock}';
|
|
|
|
protected $description = 'Unblock an IP address';
|
|
|
|
public function handle(BadIpStore $store): int
|
|
{
|
|
$ip = $this->argument('ip');
|
|
|
|
if (! $store->unblock($ip)) {
|
|
$this->components->warn("[{$ip}] was not blocked.");
|
|
|
|
return self::FAILURE;
|
|
}
|
|
|
|
$this->components->info("Unblocked [{$ip}].");
|
|
|
|
return self::SUCCESS;
|
|
}
|
|
}
|