From b9b153d5ad1dc38f1d39587a74fc7b3a3986ab02 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Fri, 23 Nov 2018 10:31:02 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=A0=B8=E5=BF=83):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=20TS+=20=E5=85=85=E5=80=BC=E7=9A=84=E6=97=B6=E5=80=99=E6=9C=80?= =?UTF-8?q?=E5=B0=8F=E9=87=91=E9=A2=9D=E6=9C=AA=E4=BD=BF=E7=94=A8=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E9=85=8D=E7=BD=AE=E9=97=AE=E9=A2=98=20fixed=20#427?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Requests/API2/StoreTransform.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Http/Requests/API2/StoreTransform.php b/app/Http/Requests/API2/StoreTransform.php index 3e78c0ea0..0e569ddf1 100644 --- a/app/Http/Requests/API2/StoreTransform.php +++ b/app/Http/Requests/API2/StoreTransform.php @@ -43,9 +43,15 @@ public function authorize(): bool public function rules(): array { $currency = $this->user()->newWallet()->firstOrCreate([], ['balance' => 0, 'total_income' => 0, 'total_expenses' => 0]); + $min = setting('currency', 'settings', ['recharge-min' => 100])['recharge-min']; return [ - 'amount' => 'required|int|min:100|max:'.$currency->balance, + 'amount' => [ + 'required', + 'integer', + sprintf('min:%d', $min), + sprintf('max:%d', $currency->balance), + ], ]; }