<?php

namespace App\Console\Commands;

use App\Models\OtpCode;
use Illuminate\Console\Command;

class ClearExpiredOtpCodes extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'app:clear-expired-otp-codes';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Clear expired otp';

    /**
     * Execute the console command.
     */
    public function handle()
    {
        OtpCode::where('expires_at', '<=', now())->delete();
    }
}
