diff --git a/src/Interfaces/Models/Transaction.php b/src/Interfaces/Models/Transaction.php index e741a230..32d6527c 100644 --- a/src/Interfaces/Models/Transaction.php +++ b/src/Interfaces/Models/Transaction.php @@ -2,7 +2,6 @@ namespace Cone\Bazar\Interfaces\Models; -use DateTimeInterface; use Illuminate\Database\Eloquent\Relations\BelongsTo; interface Transaction @@ -25,7 +24,7 @@ public function pending(): bool; /** * Mark the transaction as completed. */ - public function markAsCompleted(?DateTimeInterface $date = null): void; + public function markAsCompleted(): void; /** * Mark the transaction as pending. diff --git a/src/Models/Transaction.php b/src/Models/Transaction.php index 1aa51f0a..f06a6702 100644 --- a/src/Models/Transaction.php +++ b/src/Models/Transaction.php @@ -152,12 +152,10 @@ public function pending(): bool /** * Mark the transaction as completed. */ - public function markAsCompleted(?DateTimeInterface $date = null): void + public function markAsCompleted(): void { - $date = $date ?: Date::now(); - - if ($this->pending() || $this->completed_at->notEqualTo($date)) { - $this->setAttribute('completed_at', $date)->save(); + if ($this->pending()) { + $this->setAttribute('completed_at', Date::now())->save(); TransactionCompleted::dispatch($this); }