feat: [수주관리] order_nodes 테이블 및 모델 생성 (N-depth 트리 구조)

- order_nodes 마이그레이션: 자기참조 parent_id, 고정코어(통계용) + options JSON(하이브리드)
- order_items에 order_node_id nullable FK 추가
- OrderNode 모델: BelongsToTenant, Auditable, SoftDeletes, 트리 관계(parent/children)
- Order 모델: nodes(), rootNodes() HasMany 관계 추가
- OrderItem 모델: order_node_id fillable + node() BelongsTo 관계 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-06 20:06:14 +09:00
parent 4ae7b438f1
commit 874bf97b8f
5 changed files with 235 additions and 0 deletions

View File

@@ -161,6 +161,22 @@ public function items(): HasMany
return $this->hasMany(OrderItem::class)->orderBy('sort_order');
}
/**
* 수주 노드 (전체, depth/sort_order 순)
*/
public function nodes(): HasMany
{
return $this->hasMany(OrderNode::class)->orderBy('depth')->orderBy('sort_order');
}
/**
* 수주 루트 노드 (parent_id가 NULL인 최상위)
*/
public function rootNodes(): HasMany
{
return $this->hasMany(OrderNode::class)->whereNull('parent_id')->orderBy('sort_order');
}
/**
* 수주 이력
*/