Feature/phone register (#11)

Co-authored-by: ISMAIL MASSERAN <topaz@ISMAILs-Macbook.local>
Co-authored-by: ISMAIL MASSERAN <topaz@Mac.dlinkrouter.local>
Reviewed-on: #11
This commit was merged in pull request #11.
This commit is contained in:
2026-07-14 12:03:22 +08:00
parent 1e50e3d19f
commit b05e074456
160 changed files with 6497 additions and 759 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();
}
}