feat: BOM 테스트 및 데이터 마이그레이션
- BOM child_item_id를 새 items 테이블 ID로 마이그레이션 - Item.loadBomChildren() 수정: setRelation()으로 모델에 설정 - ItemService.validateBom() 추가: 순환 참조 방지 - error.php에 self_reference_bom 메시지 추가 - ID 7 자기참조 BOM 데이터 수정 완료 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -184,15 +184,20 @@ public function getBomChildIds(): array
|
||||
}
|
||||
|
||||
/**
|
||||
* BOM 자식 품목들 조회 (Eager Loading 최적화)
|
||||
* BOM 자식 품목들 조회 및 모델에 설정
|
||||
*/
|
||||
public function loadBomChildren()
|
||||
public function loadBomChildren(): self
|
||||
{
|
||||
$childIds = $this->getBomChildIds();
|
||||
if (empty($childIds)) {
|
||||
return collect();
|
||||
$this->setRelation('bom_children', collect());
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
return self::whereIn('id', $childIds)->get()->keyBy('id');
|
||||
$children = self::whereIn('id', $childIds)->get()->keyBy('id');
|
||||
$this->setRelation('bom_children', $children);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user