kamilcraft-api/app/Console/Commands/RemoveIPFromList.php

26 lines
556 B
PHP

<?php
declare(strict_types=1);
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\CVInfo;
class RemoveIPFromList extends Command
{
protected $signature = 'cv:rm-ip {ip : IP address on list.}';
protected $description = 'Remove IP address from show list.';
public function handle(): int
{
$ip = $this->argument('ip');
$cvInfo = CVInfo::query()->where('ip', $ip);
$cvInfo->delete();
$this->info('IP '. $ip .' deleted from database.');
return Command::SUCCESS;
}
}