'datetime', 'resolved_at' => 'datetime', 'affected_revenue' => 'decimal:2', ]; public function activities(): HasMany { return $this->hasMany(IncidentActivity::class, 'incident_id'); } public function getDurationAttribute(): string { $end = $this->resolved_at ?? now(); $diff = $this->detected_at->diff($end); if ($diff->days > 0) { return $diff->days.'d '.$diff->h.'h'; } if ($diff->h > 0) { return $diff->h.'h '.$diff->i.'min'; } return $diff->i.' min'; } public function getSeverityColorAttribute(): string { return match ($this->severity) { 'critical' => '#ef4444', 'high' => '#f97316', 'medium' => '#eab308', 'low' => '#22c55e', default => '#6b7280', }; } public function getStatusLabelAttribute(): string { return match ($this->status) { 'open' => 'Offen', 'in_progress' => 'In Bearbeitung', 'waiting_provider' => 'Wartet auf Anbieter', 'resolved' => 'Gelöst', 'closed' => 'Geschlossen', default => $this->status, }; } public function getProviderLabelAttribute(): string { return match ($this->provider) { 'payone' => 'PAYONE', 'stripe' => 'Stripe', 'paypal' => 'PayPal', 'mollie' => 'Mollie', default => 'Sonstige', }; } }