From e086586e8e1465b4e106454b31a91ab2734fcfa6 Mon Sep 17 00:00:00 2001 From: tokumeikoi Date: Thu, 30 Jun 2022 03:22:17 +0800 Subject: [PATCH] update: add inventory limit --- app/Http/Controllers/User/OrderController.php | 4 ++++ resources/lang/en-US.json | 3 ++- resources/lang/zh-CN.json | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/User/OrderController.php b/app/Http/Controllers/User/OrderController.php index 3d0f4a94..b6fc7660 100755 --- a/app/Http/Controllers/User/OrderController.php +++ b/app/Http/Controllers/User/OrderController.php @@ -85,6 +85,10 @@ class OrderController extends Controller abort(500, __('Subscription plan does not exist')); } + if ($plan->inventory_limit !== NULL && !$plan->inventory_limit) { + abort(500, __('Current product is sold out')); + } + if ($plan[$request->input('period')] === NULL) { abort(500, __('This payment period cannot be purchased, please choose another period')); } diff --git a/resources/lang/en-US.json b/resources/lang/en-US.json index 387f5519..38d275f6 100644 --- a/resources/lang/en-US.json +++ b/resources/lang/en-US.json @@ -92,5 +92,6 @@ "Uh-oh, we've had some problems, we're working on it.": "Uh-oh, we've had some problems, we're working on it", "This subscription reset package does not apply to your subscription": "This subscription reset package does not apply to your subscription", "Login to :name": "Login to :name", - "Sending frequently, please try again later": "Sending frequently, please try again later" + "Sending frequently, please try again later": "Sending frequently, please try again later", + "Current product is sold out": "Current product is sold out" } diff --git a/resources/lang/zh-CN.json b/resources/lang/zh-CN.json index 239a0e3e..a9e4c50c 100644 --- a/resources/lang/zh-CN.json +++ b/resources/lang/zh-CN.json @@ -92,5 +92,6 @@ "Uh-oh, we've had some problems, we're working on it.": "遇到了些问题,我们正在进行处理", "This subscription reset package does not apply to your subscription": "该订阅重置包不适用于你的订阅", "Login to :name": "登入到 :name", - "Sending frequently, please try again later": "发送频繁,请稍后再试" + "Sending frequently, please try again later": "发送频繁,请稍后再试", + "Current product is sold out": "当前商品已售罄" }