- esign_contracts: verification_required, verification_template_id 컬럼 추가 - esign_signers: verification_status, verification_passed_at 컬럼 추가 - 서명 플로우: OTP 인증 → 필기 확인(verification.blade.php) → 서명/도장 - auth.blade.php: verification_required 시 필기 확인 페이지로 리다이렉트 - create.blade.php: 필기 확인 사용 토글 + 템플릿 선택 UI - EsignApiController: store()에 verification 필드 저장 - EsignPublicController: getVerification(), submitVerification() 추가 - 감사 로그: verification_viewed, verification_attempted, verification_passed, verification_completed 액션
77 lines
1.9 KiB
PHP
77 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Models\ESign;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class EsignContract extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'esign_contracts';
|
|
|
|
protected $fillable = [
|
|
'tenant_id',
|
|
'contract_code',
|
|
'title',
|
|
'description',
|
|
'sign_order_type',
|
|
'original_file_path',
|
|
'original_file_name',
|
|
'original_file_hash',
|
|
'original_file_size',
|
|
'signed_file_path',
|
|
'signed_file_hash',
|
|
'status',
|
|
'send_method',
|
|
'sms_fallback',
|
|
'completion_template_name',
|
|
'verification_required',
|
|
'verification_template_id',
|
|
'metadata',
|
|
'expires_at',
|
|
'completed_at',
|
|
'created_by',
|
|
'updated_by',
|
|
'deleted_by',
|
|
];
|
|
|
|
protected $casts = [
|
|
'original_file_size' => 'integer',
|
|
'sms_fallback' => 'boolean',
|
|
'verification_required' => 'boolean',
|
|
'verification_template_id' => 'integer',
|
|
'metadata' => 'array',
|
|
'expires_at' => 'datetime',
|
|
'completed_at' => 'datetime',
|
|
];
|
|
|
|
public function signers(): HasMany
|
|
{
|
|
return $this->hasMany(EsignSigner::class, 'contract_id');
|
|
}
|
|
|
|
public function signFields(): HasMany
|
|
{
|
|
return $this->hasMany(EsignSignField::class, 'contract_id');
|
|
}
|
|
|
|
public function verificationTemplate(): BelongsTo
|
|
{
|
|
return $this->belongsTo(EsignVerificationTemplate::class, 'verification_template_id');
|
|
}
|
|
|
|
public function auditLogs(): HasMany
|
|
{
|
|
return $this->hasMany(EsignAuditLog::class, 'contract_id');
|
|
}
|
|
|
|
public function scopeForTenant($query, $tenantId)
|
|
{
|
|
return $query->where('tenant_id', $tenantId);
|
|
}
|
|
}
|