<?php

namespace App\Models;

use Carbon\Carbon;

class VerifyCode extends BaseModel
{
    public static function InvokeCodes($userId, $type): void
    {
        $codes = VerifyCode::where('user_uuid', $userId)->where('type', $type)->whereNull('invoked_at')->get();
        foreach ($codes as $code) {
            $code->invoked_at = Carbon::now();
            $code->save();
        }
    }
}
