Skip to content

Commit

Permalink
Merge pull request #189 from mmcomp/feature/bug_coupon_should_be_used…
Browse files Browse the repository at this point in the history
…_once

remove bug expired_at
  • Loading branch information
marykhodaparast committed May 30, 2021
2 parents 6a2fc36 + 398ab5e commit 87aa0e1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/Http/Controllers/User/CartController.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public function addCouponToTheCart(AddCouponToTheCartRequest $request)
return (new OrderResource(null))->additional([
'errors' => ["already applied" => ["The discount code has already been applied."]],
])->response()->setStatusCode(406);
} else if($coupon->expired_at < Carbon::now()->format('Y-m-d') ) {
} else if($coupon->expired_at != null && $coupon->expired_at < Carbon::now()->format('Y-m-d') ) {
return (new OrderResource(null))->additional([
'errors' => ["expired" => ["The discount code has been expired"]],
])->response()->setStatusCode(406);
Expand Down

0 comments on commit 87aa0e1

Please sign in to comment.