38 lines
794 B
PHP
38 lines
794 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Services\VerificationCodeService;
|
|
use Illuminate\Console\Command;
|
|
|
|
class CleanupExpiredCodes extends Command
|
|
{
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'codes:cleanup';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'Cleanup expired verification codes';
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*/
|
|
public function handle(VerificationCodeService $service): int
|
|
{
|
|
$this->info('Cleaning up expired verification codes...');
|
|
|
|
$deleted = $service->cleanupExpiredCodes();
|
|
|
|
$this->info("Deleted {$deleted} expired codes.");
|
|
|
|
return Command::SUCCESS;
|
|
}
|
|
}
|