<?php

namespace App\Models;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class EskizToken extends Model
{
    use HasFactory;

    protected $fillable = ['token', 'expires_at'];

    protected $dates = ['expires_at'];

    /**
     * Token amal qiladimi?
     */
    public function isValid(): bool
    {
        return $this->expires_at && Carbon::now()->lt($this->expires_at);
    }

}
