<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;

class BannedIp extends Model
{
    protected $guarded = [];

    protected $casts = ['banned_until' => 'datetime'];

    /** Non-expired bans only. */
    public function scopeActive(Builder $query): Builder
    {
        return $query->where('banned_until', '>', now());
    }
}
