- ClientService stats() active/inactive 카운트 추가 - DocumentTemplateSection file_id 컬럼 마이그레이션 - 논리 관계 문서 업데이트 (BendingItemMapping 추가)
47 lines
1.1 KiB
PHP
47 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Documents;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
/**
|
|
* 문서 양식 섹션 모델
|
|
*
|
|
* @property int $id
|
|
* @property int $template_id
|
|
* @property string $title 섹션 제목
|
|
* @property string|null $image_path 검사 기준 이미지 경로 (R2 key)
|
|
* @property int|null $file_id 도해 이미지 파일 ID (files 테이블 참조)
|
|
* @property int $sort_order 정렬 순서
|
|
*/
|
|
class DocumentTemplateSection extends Model
|
|
{
|
|
protected $table = 'document_template_sections';
|
|
|
|
protected $fillable = [
|
|
'template_id',
|
|
'title',
|
|
'description',
|
|
'image_path',
|
|
'file_id',
|
|
'sort_order',
|
|
];
|
|
|
|
protected $casts = [
|
|
'sort_order' => 'integer',
|
|
];
|
|
|
|
public function template(): BelongsTo
|
|
{
|
|
return $this->belongsTo(DocumentTemplate::class, 'template_id');
|
|
}
|
|
|
|
public function items(): HasMany
|
|
{
|
|
return $this->hasMany(DocumentTemplateSectionItem::class, 'section_id')
|
|
->orderBy('sort_order');
|
|
}
|
|
}
|