This commit is contained in:
ct
2025-07-03 20:27:48 +08:00
parent 3d7b3c428b
commit 3edfedecdd
7 changed files with 17 additions and 14 deletions

View File

@@ -37,12 +37,12 @@ public function isExpired(): bool
public function isUsed(): bool
{
return !is_null($this->used_at);
return ! is_null($this->used_at);
}
public function isValid(): bool
{
return !$this->isExpired() && !$this->isUsed();
return ! $this->isExpired() && ! $this->isUsed();
}
public function markAsUsed(): void
@@ -53,11 +53,11 @@ public function markAsUsed(): void
public function scopeExpiredAndUnused($query)
{
return $query->where('expires_at', '<', now())
->whereNull('used_at');
->whereNull('used_at');
}
public function scopeForUser($query, $userId)
{
return $query->where('user_id', $userId);
}
}
}