- 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 액션
85 lines
2.0 KiB
PHP
85 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models\ESign;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class EsignSigner extends Model
|
|
{
|
|
protected $table = 'esign_signers';
|
|
|
|
// 역할 상수
|
|
public const ROLE_CREATOR = 'creator';
|
|
|
|
public const ROLE_COUNTERPART = 'counterpart';
|
|
|
|
// 상태 상수
|
|
public const STATUS_WAITING = 'waiting';
|
|
|
|
public const STATUS_NOTIFIED = 'notified';
|
|
|
|
public const STATUS_AUTHENTICATED = 'authenticated';
|
|
|
|
public const STATUS_SIGNED = 'signed';
|
|
|
|
public const STATUS_REJECTED = 'rejected';
|
|
|
|
protected $fillable = [
|
|
'tenant_id',
|
|
'contract_id',
|
|
'role',
|
|
'sign_order',
|
|
'name',
|
|
'email',
|
|
'phone',
|
|
'access_token',
|
|
'token_expires_at',
|
|
'otp_code',
|
|
'otp_expires_at',
|
|
'otp_attempts',
|
|
'auth_verified_at',
|
|
'signature_image_path',
|
|
'signed_at',
|
|
'consent_agreed_at',
|
|
'sign_ip_address',
|
|
'sign_user_agent',
|
|
'status',
|
|
'rejected_reason',
|
|
'verification_status',
|
|
'verification_passed_at',
|
|
];
|
|
|
|
protected $casts = [
|
|
'sign_order' => 'integer',
|
|
'otp_attempts' => 'integer',
|
|
'token_expires_at' => 'datetime',
|
|
'otp_expires_at' => 'datetime',
|
|
'auth_verified_at' => 'datetime',
|
|
'signed_at' => 'datetime',
|
|
'consent_agreed_at' => 'datetime',
|
|
'verification_passed_at' => 'datetime',
|
|
];
|
|
|
|
protected $hidden = [
|
|
'access_token',
|
|
'otp_code',
|
|
];
|
|
|
|
public function contract(): BelongsTo
|
|
{
|
|
return $this->belongsTo(EsignContract::class, 'contract_id');
|
|
}
|
|
|
|
public function signFields(): HasMany
|
|
{
|
|
return $this->hasMany(EsignSignField::class, 'signer_id');
|
|
}
|
|
|
|
public function scopeForTenant($query, $tenantId)
|
|
{
|
|
return $query->where('tenant_id', $tenantId);
|
|
}
|
|
}
|