$this->id, 'activity_id' => $this->activity_id, 'activity' => new ActivityResource($this->whenLoaded('activity')), 'report_text' => $this->report_text, 'prepared_by' => $this->prepared_by, 'prepared_by_user' => $this->whenLoaded('preparedBy', fn () => [ 'id' => $this->preparedBy->id, 'name' => $this->preparedBy->name, 'email' => $this->preparedBy->email, ]), 'created_at' => $this->created_at?->toISOString(), 'updated_at' => $this->updated_at?->toISOString(), ]; } }