| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Factories\HasFactory;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Database\Eloquent\Relations\BelongsTo;
- class IdentityVerification extends Model
- {
- use HasFactory;
- protected $table = 'identity_verifications';
- protected $fillable = [
- 'user_id',
- 'session_id',
- 'session_token',
- 'workflow_id',
- 'didit_status',
- 'attempt',
- 'id_verification_status',
- 'liveness_status',
- 'face_match_status',
- 'liveness_score',
- 'face_match_score',
- 'warnings',
- 'decision',
- 'reviewed_by',
- 'reviewed_at',
- 'review_comment',
- 'started_at',
- 'completed_at',
- ];
- protected function casts(): array
- {
- return [
- 'attempt' => 'integer',
- 'liveness_score' => 'float',
- 'face_match_score' => 'float',
- 'warnings' => 'array',
- 'decision' => 'array',
- 'reviewed_at' => 'datetime',
- 'started_at' => 'datetime',
- 'completed_at' => 'datetime',
- ];
- }
- public function user(): BelongsTo
- {
- return $this->belongsTo(User::class);
- }
- public function reviewer(): BelongsTo
- {
- return $this->belongsTo(User::class, 'reviewed_by');
- }
- /** Warnings acionaveis: o Didit marca os informativos com log_type = information. */
- public function actionableWarnings(): array
- {
- return array_values(array_filter(
- $this->warnings ?? [],
- static fn ($warning) => data_get($warning, 'log_type') === 'warning',
- ));
- }
- }
|