<?php

namespace App\Tasks;

use App\Models\PersonalAccessToken;
use Illuminate\Support\Facades\Log;

class DeleteExpiredTokens
{
    public function __invoke(): void
    {
        $deletedTokens = PersonalAccessToken::where(column: 'expires_at', operator: '<', value: now())->delete();
        Log::channel(channel: 'expiredTokens')->info(message: 'Tokens expirados excluídos: '.$deletedTokens);
    }
}
