DONE: phone number verification, admin can add user employment; WIP: wire with onewaysms

This commit is contained in:
ISMAIL MASSERAN
2026-07-12 12:36:46 +08:00
parent 431bbee17c
commit a11b75729a
37 changed files with 2214 additions and 73 deletions
@@ -0,0 +1,49 @@
<?php
namespace Modules\Auth\Entities;
use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Model;
class PhoneVerificationOtp extends Model
{
use HasUuids;
protected $table = 'phone_verification_otps';
protected $fillable = [
'phone_number',
'code',
'expires_at',
'attempts',
'verified_at',
'verification_token',
'verification_token_expires_at',
];
protected function casts(): array
{
return [
'expires_at' => 'datetime',
'attempts' => 'integer',
'verified_at' => 'datetime',
'verification_token_expires_at' => 'datetime',
];
}
public function isExpired(): bool
{
return $this->expires_at->isPast();
}
public function hasExceededMaxAttempts(): bool
{
return $this->attempts >= (int) config('auth.phone_verification.max_attempts', 5);
}
public function isVerificationTokenExpired(): bool
{
return $this->verification_token_expires_at === null
|| $this->verification_token_expires_at->isPast();
}
}