- 템플릿 관리 전용 페이지 (카드 그리드, 검색/필터, 편집/복제/삭제) - API: showTemplate, updateTemplate, duplicateTemplate 추가 - indexTemplates에 category/search 필터 추가 - 계약 생성 시 템플릿 선택 UI 추가 - 필드 에디터에서 URL 파라미터 template_id 자동 적용 - EsignFieldTemplate 모델에 category 필드 추가 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
48 lines
1.1 KiB
PHP
48 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models\ESign;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class EsignFieldTemplate extends Model
|
|
{
|
|
protected $table = 'esign_field_templates';
|
|
|
|
protected $fillable = [
|
|
'tenant_id',
|
|
'name',
|
|
'description',
|
|
'category',
|
|
'signer_count',
|
|
'is_active',
|
|
'created_by',
|
|
];
|
|
|
|
protected $casts = [
|
|
'signer_count' => 'integer',
|
|
'is_active' => 'boolean',
|
|
];
|
|
|
|
public function scopeForTenant($query, $tenantId)
|
|
{
|
|
return $query->where('tenant_id', $tenantId);
|
|
}
|
|
|
|
public function scopeByCategory($query, $category)
|
|
{
|
|
return $query->where('category', $category);
|
|
}
|
|
|
|
public function items(): HasMany
|
|
{
|
|
return $this->hasMany(EsignFieldTemplateItem::class, 'template_id')->orderBy('sort_order');
|
|
}
|
|
|
|
public function creator(): BelongsTo
|
|
{
|
|
return $this->belongsTo(\App\Models\User::class, 'created_by');
|
|
}
|
|
}
|