'decimal:2', ]; } public function report(): BelongsTo { return $this->belongsTo(WeeklyStatusReport::class, 'weekly_status_report_id'); } // --- Accessors --- public function getTotalIncidentsAttribute(): int { return $this->fatalities + $this->major_injuries + $this->first_aid_cases + $this->medical_cases + $this->near_misses + $this->environmental_damage + $this->property_damage; } public function getHasZeroIncidentsAttribute(): bool { return $this->total_incidents === 0 && (float) $this->fines === 0.0; } /** * Returns each reactive field as a labeled array for UI rendering. */ public function getReactiveBreakdownAttribute(): array { return [ ['label' => 'Fatalities', 'value' => $this->fatalities], ['label' => 'Major Injuries', 'value' => $this->major_injuries], ['label' => 'First Aid Cases', 'value' => $this->first_aid_cases], ['label' => 'Medical Cases', 'value' => $this->medical_cases], ['label' => 'Near Misses', 'value' => $this->near_misses], ['label' => 'Environmental Damage', 'value' => $this->environmental_damage], ['label' => 'Property Damage', 'value' => $this->property_damage], ['label' => 'Fines/Costs', 'value' => $this->fines, 'isCurrency' => true], ]; } }