'integer', 'max_accounts' => 'integer', 'capacity_percent' => 'decimal:2', 'resource_usage' => 'array', 'is_resolved' => 'boolean', 'resolved_at' => 'datetime', ]; public function hostingNode(): BelongsTo { return $this->belongsTo(HostingNode::class); } public function resolvedBy(): BelongsTo { return $this->belongsTo(User::class, 'resolved_by'); } public function scopeUnresolved($query) { return $query->where('is_resolved', false); } public function scopeCritical($query) { return $query->whereIn('alert_type', [self::TYPE_CAPACITY_CRITICAL, self::TYPE_NEEDS_EXPANSION]); } public function resolve(User $admin, ?string $notes = null): void { $this->update([ 'is_resolved' => true, 'resolved_by' => $admin->id, 'resolved_at' => now(), 'resolution_notes' => $notes, ]); } public function isCritical(): bool { return in_array($this->alert_type, [self::TYPE_CAPACITY_CRITICAL, self::TYPE_NEEDS_EXPANSION]); } }