$this->id, 'code' => $this->code, 'legacy_code' => $this->legacy_code, // 정규 컬럼 직접 참조 'item_name' => $this->item_name, 'item_sep' => $this->item_sep, 'item_bending' => $this->item_bending, 'item_spec' => $this->item_spec, 'material' => $this->material, 'model_name' => $this->model_name, 'model_UA' => $this->model_UA, 'rail_width' => $this->rail_width ? (int) $this->rail_width : null, // 케이스 전용 'exit_direction' => $this->exit_direction, 'front_bottom' => $this->front_bottom ? (int) $this->front_bottom : null, 'box_width' => $this->box_width ? (int) $this->box_width : null, 'box_height' => $this->box_height ? (int) $this->box_height : null, 'inspection_door' => $this->inspection_door, // 원자재 길이 'length_code' => $this->length_code, 'length_mm' => $this->length_mm, // 전개도 (JSON 컬럼) 'bendingData' => $this->bending_data, // 비정형 속성 (options) 'search_keyword' => $this->getOption('search_keyword'), 'author' => $this->getOption('author'), 'memo' => $this->getOption('memo'), 'registration_date' => $this->getOption('registration_date'), // 이미지 'image_file_id' => $this->getImageFileId(), // 추적 'legacy_bending_id' => $this->legacy_bending_id, 'legacy_bending_num' => $this->legacy_bending_id, // MNG2 호환 'modified_by' => $this->getOption('modified_by'), // MNG2 호환 (items 기반 필드명) 'name' => $this->item_name, 'front_bottom_width' => $this->front_bottom ? (int) $this->front_bottom : null, 'item_type' => 'PT', 'item_category' => 'BENDING', 'unit' => 'EA', // 계산값 'width_sum' => $this->width_sum, 'bend_count' => $this->bend_count, // 메타 'is_active' => $this->is_active, 'created_at' => $this->created_at?->format('Y-m-d H:i:s'), 'updated_at' => $this->updated_at?->format('Y-m-d H:i:s'), ]; } private function getImageFileId(): ?int { $file = $this->files() ->where('field_key', 'bending_diagram') ->orderByDesc('id') ->first(); return $file?->id; } }