*/ public function toArray(Request $request): array { return [ 'id' => $this->id, 'intervention_id' => $this->intervention_id, 'file' => $this->whenLoaded('file', function () { return [ 'id' => $this->file->id, 'name' => $this->file->name, 'path' => $this->file->path, 'mime_type' => $this->file->mime_type, 'size' => $this->file->size ]; }), 'label' => $this->label, 'created_at' => $this->created_at->format('Y-m-d H:i:s') ]; } }