2026-01-27 11:31:02 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
|
|
|
|
|
|
class DocumentTemplateSection extends Model
|
|
|
|
|
{
|
|
|
|
|
use HasFactory;
|
|
|
|
|
|
|
|
|
|
protected $fillable = [
|
|
|
|
|
'template_id',
|
|
|
|
|
'title',
|
2026-03-07 03:05:07 +09:00
|
|
|
'description',
|
2026-01-27 11:31:02 +09:00
|
|
|
'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');
|
|
|
|
|
}
|
2026-02-25 11:45:01 +09:00
|
|
|
}
|