44 lines
1016 B
PHP
44 lines
1016 B
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 검사 기준 이미지 경로
|
||
|
|
* @property int $sort_order 정렬 순서
|
||
|
|
*/
|
||
|
|
class DocumentTemplateSection extends Model
|
||
|
|
{
|
||
|
|
protected $table = 'document_template_sections';
|
||
|
|
|
||
|
|
protected $fillable = [
|
||
|
|
'template_id',
|
||
|
|
'title',
|
||
|
|
'image_path',
|
||
|
|
'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');
|
||
|
|
}
|
||
|
|
}
|