28 lines
520 B
PHP
28 lines
520 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class PasswordResetOtp extends Model
|
|
{
|
|
protected $fillable = [
|
|
'email',
|
|
'otp',
|
|
'expires_at',
|
|
'is_used',
|
|
];
|
|
|
|
protected $casts = [
|
|
'expires_at' => 'datetime',
|
|
'is_used' => 'boolean',
|
|
];
|
|
|
|
/**
|
|
* Cek apakah OTP masih valid (belum expired & belum dipakai)
|
|
*/
|
|
public function isValid(): bool
|
|
{
|
|
return ! $this->is_used && $this->expires_at->isFuture();
|
|
}
|
|
} |