Files
sam-api/app/Models/ProcessStep.php
권혁성 e885b1ca45 feat(API): 중간검사 문서 템플릿 동적 연동 - process_steps ↔ document_templates 연결
- process_steps 테이블에 document_template_id FK 추가 (migration)
- ProcessStep 모델에 documentTemplate BelongsTo 관계 추가
- ProcessStepService에서 documentTemplate eager loading
- StoreProcessStepRequest/UpdateProcessStepRequest에 document_template_id 유효성 검증
- WorkOrderService에 getInspectionTemplate(), createInspectionDocument() 메서드 추가
- WorkOrderController에 inspection-template/inspection-document 엔드포인트 추가
- DocumentService.formatTemplateForReact() 접근자 public으로 변경
- i18n 메시지 키 추가 (inspection_document_created, no_inspection_template)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 08:35:57 +09:00

53 lines
1.1 KiB
PHP

<?php
namespace App\Models;
use App\Models\Documents\DocumentTemplate;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class ProcessStep extends Model
{
use HasFactory;
protected $fillable = [
'process_id',
'step_code',
'step_name',
'is_required',
'needs_approval',
'needs_inspection',
'document_template_id',
'is_active',
'sort_order',
'connection_type',
'connection_target',
'completion_type',
];
protected $casts = [
'is_required' => 'boolean',
'needs_approval' => 'boolean',
'needs_inspection' => 'boolean',
'is_active' => 'boolean',
'sort_order' => 'integer',
];
/**
* 공정
*/
public function process(): BelongsTo
{
return $this->belongsTo(Process::class);
}
/**
* 문서 양식 (검사 시 사용할 템플릿)
*/
public function documentTemplate(): BelongsTo
{
return $this->belongsTo(DocumentTemplate::class);
}
}