feat: [receiving] 입고 성적서 파일 연결 기능 추가
- receivings 테이블에 certificate_file_id 컬럼 추가 (마이그레이션) - Receiving 모델에 certificateFile 관계 및 fillable/casts 추가 - Store/Update Request에 certificate_file_id 검증 규칙 추가 - ReceivingService index/show에 certificateFile eager loading 추가 - store/update 시 certificate_file_id 저장 처리 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -16,7 +16,7 @@ public function index(array $params): LengthAwarePaginator
|
||||
$tenantId = $this->tenantId();
|
||||
|
||||
$query = Receiving::query()
|
||||
->with(['creator:id,name', 'item:id,item_type,code,name'])
|
||||
->with(['creator:id,name', 'item:id,item_type,code,name', 'certificateFile:id,display_name,file_path'])
|
||||
->where('tenant_id', $tenantId);
|
||||
|
||||
// 검색어 필터
|
||||
@@ -162,7 +162,7 @@ public function show(int $id): Receiving
|
||||
|
||||
return Receiving::query()
|
||||
->where('tenant_id', $tenantId)
|
||||
->with(['creator:id,name', 'item:id,item_type,code,name'])
|
||||
->with(['creator:id,name', 'item:id,item_type,code,name', 'certificateFile:id,display_name,file_path'])
|
||||
->findOrFail($id);
|
||||
}
|
||||
|
||||
@@ -203,6 +203,11 @@ public function store(array $data): Receiving
|
||||
$receiving->status = $data['status'] ?? 'receiving_pending';
|
||||
$receiving->remark = $data['remark'] ?? null;
|
||||
|
||||
// 성적서 파일 ID
|
||||
if (isset($data['certificate_file_id'])) {
|
||||
$receiving->certificate_file_id = $data['certificate_file_id'];
|
||||
}
|
||||
|
||||
// options 필드 처리 (제조사, 수입검사 등 확장 필드)
|
||||
$receiving->options = $this->buildOptions($data);
|
||||
|
||||
@@ -299,6 +304,11 @@ public function update(int $id, array $data): Receiving
|
||||
}
|
||||
}
|
||||
|
||||
// 성적서 파일 ID
|
||||
if (array_key_exists('certificate_file_id', $data)) {
|
||||
$receiving->certificate_file_id = $data['certificate_file_id'];
|
||||
}
|
||||
|
||||
// options 필드 업데이트 (제조사, 수입검사 등 확장 필드)
|
||||
$receiving->options = $this->mergeOptions($receiving->options, $data);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user