diff --git a/src/Model/Promocodes.php b/src/Model/Promocodes.php index bea366b..5c6efaa 100644 --- a/src/Model/Promocodes.php +++ b/src/Model/Promocodes.php @@ -210,7 +210,7 @@ public function check($code) public function apply($code, $hard_check = false) { $record = Promocodes::where('code', $code) - // ->whereNull('is_used') + ->whereNull('is_used') ->where('quantity', '!=' , 0) // -1 for infinite ->where(function($q) { $q->whereDate('expiry_date', '<' , Carbon::today()) @@ -222,7 +222,7 @@ public function apply($code, $hard_check = false) if ($record->quantity > 0) { $record->quantity--; } - // $record->is_used = date('Y-m-d H:i:s'); + $record->is_used = Carbon::now(); if ($record->save()) { if ($hard_check) {