From aa65440556907012bdb79f4248ce8de1497788d2 Mon Sep 17 00:00:00 2001 From: tokumeikoi Date: Thu, 30 Jun 2022 03:20:13 +0800 Subject: [PATCH] update: add inventory limit --- app/Services/PlanService.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/app/Services/PlanService.php b/app/Services/PlanService.php index f6d771b0..1a75b743 100644 --- a/app/Services/PlanService.php +++ b/app/Services/PlanService.php @@ -13,17 +13,15 @@ class PlanService $this->plan = Plan::lockForUpdate()->find($planId); } - public function incrementInventory() + public function incrementInventory(): bool { - if ($this->plan->inventory_limit !== NULL) { - return $this->plan->increment('inventory_limit'); - } + if ($this->plan->inventory_limit !== NULL) return true; + return $this->plan->increment('inventory_limit'); } - public function decrementInventory() + public function decrementInventory(): bool { - if ($this->plan->inventory_limit !== NULL) { - return $this->plan->decrement('inventory_limit'); - } + if ($this->plan->inventory_limit !== NULL) return true; + return $this->plan->decrement('inventory_limit'); } }