- 모델: EsignFieldTemplate fillable에 file 컬럼 추가 - storeTemplate: include_pdf + contract_id로 계약 PDF를 템플릿으로 복사 - store(계약 생성): template_id로 템플릿 PDF 자동 복사 (사용자 업로드 우선) - duplicateTemplate: 복제 시 PDF 파일도 복사 - 템플릿 PDF 다운로드 엔드포인트 추가 - SaveTemplateModal: "현재 PDF 파일 포함" 체크박스 추가 - create: 템플릿 카드에 PDF 뱃지, PDF 자동 사용 안내 - templates: 템플릿 카드에 PDF 파일명 표시 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
52 lines
1.1 KiB
PHP
52 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',
|
|
'file_path',
|
|
'file_name',
|
|
'file_hash',
|
|
'file_size',
|
|
'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');
|
|
}
|
|
}
|