'boolean', 'whole_site' => 'boolean', 'hits' => 'integer', 'last_hit_at' => 'datetime', 'expires_at' => 'datetime', 'created_at' => 'datetime']; } /** The list of bans for the whole site is kept in the cache (IpBans::wholeSite): any change makes it stale. */ protected static function booted(): void { static::saved(fn () => IpBans::forgetWholeSite()); static::deleted(fn () => IpBans::forgetWholeSite()); } /** * Bans that still keep their address out. * * @param Builder $query */ public function scopeActive(Builder $query): void { $query->where(fn (Builder $q) => $q->whereNull('expires_at')->orWhere('expires_at', '>', now())); } public function isActive(): bool { return $this->expires_at === null || $this->expires_at->isFuture(); } }