Files
sam-manage/app/Models/ESign/EsignFieldTemplate.php
김보곤 5ffabed6b4 feat:E-Sign 템플릿 변수 자동채움 시스템 구현
- 시스템 변수 (서명자명, 이메일, 계약제목, 날짜 등) 자동 해석
- 커스텀 변수 정의/관리 (템플릿별 계약금액, 기간 등)
- 템플릿 필드 에디터: 변수 관리 + 필드-변수 바인딩 UI
- 계약 생성 폼: 템플릿 변수 입력 섹션 추가
- 계약 필드 에디터: 변수 연결 정보 표시
- PdfSignatureService: font_size 반영 렌더링

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 10:11:14 +09:00

54 lines
1.2 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',
'file_path',
'file_name',
'file_hash',
'file_size',
'signer_count',
'variables',
'is_active',
'created_by',
];
protected $casts = [
'signer_count' => 'integer',
'variables' => 'array',
'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');
}
}