From 54d1226c8b5d1b453691722b669c9e4d7de7e2dd Mon Sep 17 00:00:00 2001 From: tokumeikoi Date: Fri, 15 Jan 2021 00:33:30 +0900 Subject: [PATCH] fix: coupon generate --- app/Http/Controllers/Admin/CouponController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Admin/CouponController.php b/app/Http/Controllers/Admin/CouponController.php index 766a23d2..61384287 100644 --- a/app/Http/Controllers/Admin/CouponController.php +++ b/app/Http/Controllers/Admin/CouponController.php @@ -95,7 +95,9 @@ class CouponController extends Controller { $coupons = []; $coupon = $request->validated(); - $coupon['limit_plan_ids'] = json_encode($coupon['limit_plan_ids']); + if (isset($coupon['limit_plan_ids'])) { + $coupon['limit_plan_ids'] = json_encode($coupon['limit_plan_ids']); + } $coupon['created_at'] = $coupon['updated_at'] = time(); unset($coupon['generate_count']); for ($i = 0;$i < $request->input('generate_count');$i++) {