- Auditable 트레이트 신규 생성 (bootAuditable 패턴)
- creating: created_by/updated_by 자동 채우기
- updating: updated_by 자동 채우기
- deleting: deleted_by 채우기 + saveQuietly()
- created/updated/deleted: audit_logs 자동 기록
- 기존 AuditLogger 패턴과 동일한 try/catch 조용한 실패
- 변경된 필드만 before/after 기록 (updated 이벤트)
- auditExclude 프로퍼티로 모델별 제외 필드 설정 가능
- 제외 대상: Attendance, StockTransaction, TodayIssue 등 고빈도/시스템 모델
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- GET /items/{id} 응답에 BOM 확장 데이터 포함
- child_item_code, child_item_name, unit, specification 필드 추가
- expandBomData() 메서드 구현 (ItemsService)
- Product 모델 bom 캐스팅 추가
- products 테이블에 options JSON 컬럼 추가 (마이그레이션)
- Material/Product 모델에 options 필드 추가 (fillable, casts)
- SystemFields::PRODUCTS에 options 상수 추가
- MaterialService/ProductService에 동적 필드 자동 추출 로직:
- getKnownFields(): SystemFields + ItemField 기반 고정 필드 조회
- extractDynamicOptions(): 동적 필드 추출
- normalizeOptions(): [{label, value, unit}] 형태로 정규화
- material_code 중복 체크 시 soft delete 포함 (withTrashed)
- 사용 중인 자재 삭제 방지 (checkMaterialUsage)
- Material 모델에 category 관계 추가
- is_active 컬럼 추가 마이그레이션 (default 1)
- Product 모델 fillable 및 casts 업데이트
- Material 모델 fillable 및 casts 업데이트
- Material 모델에 material_type fillable 추가
- ModelTrait의 scopeActive() 메서드 지원
- Products 테이블에 9개 파일 관련 필드 추가
- bending_diagram, bending_details (JSON)
- specification_file, specification_file_name
- certification_file, certification_file_name
- certification_number, certification_start_date, certification_end_date
- ItemsFileController 구현 (Code-based API)
- POST /items/{code}/files - 파일 업로드
- DELETE /items/{code}/files/{type} - 파일 삭제
- 파일 타입: bending_diagram, specification, certification
- ItemsFileUploadRequest 검증
- 파일 타입별 MIME 검증 (이미지/문서)
- 파일 크기 제한 (10MB/20MB)
- 인증 정보 및 절곡 상세 정보 검증
- Swagger 문서 작성 (ItemsFileApi.php)
- 업로드/삭제 API 스펙
- 스키마: ItemFileUploadResponse, ItemFileDeleteResponse
[모델 업데이트]
- Product 모델: 하이브리드 구조 필드로 fillable/casts 간소화
- 고정 필드: safety_stock, lead_time, is_variable_size, product_category, part_type, attributes_archive
- 동적 필드: attributes JSON (category_fields로 관리)
- 제거: BP-MES 전용 33개 필드 (이제 attributes에 저장)
- ProductComponent 모델: BOM 계산 필드 + 동적 필드
- 고정 필드: quantity_formula, condition
- 동적 필드: attributes JSON
- 제거: is_bending, bending_diagram, bending_details (이제 attributes에 저장)
[Seeder 실행]
- BpMesCategoryFieldsSeeder: FG/PT/절곡품 카테고리 및 필드 생성
- BpMesTenantStatFieldsSeeder: 통계 필드 설정 (마진율, 가공비, 인건비, 설치비 등)
[검증 완료]
- Tinker 모델 테스트 통과
- Pint 코드 포맷팅 검사 통과
- Material 모델
- fillable 속성 추가 (모든 필드 명시)
- User 모델
- BelongsToMany 관계 타입 힌트 추가
- Product 모델
- fillable에 unit 필드 추가
- casts 순서 정리 (boolean 그룹화)
- ProductComponent 모델
- quantity 캐스트 정밀도 변경 (decimal:4 → decimal:6)
- referencedItem() 메서드 추가 (동적 관계 로드)
- product(), material() 관계 메서드 수정 (where 조건 추가)
- is_default 캐스트 제거 (컬럼 없음)
- Tenant 모델
- options 캐스트 추가 (array)
- scopeActive() 추가 (trial, active 상태 필터링)
- isActive(), isTrial() 헬퍼 메서드 추가
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>