mirror of
				https://github.com/v2board/v2board.git
				synced 2025-10-31 09:21:46 +08:00 
			
		
		
		
	add custom coupon code
This commit is contained in:
		| @@ -28,7 +28,9 @@ class CouponController extends Controller | |||||||
|             $params['limit_plan_ids'] = json_encode($params['limit_plan_ids']); |             $params['limit_plan_ids'] = json_encode($params['limit_plan_ids']); | ||||||
|         } |         } | ||||||
|         if (!$request->input('id')) { |         if (!$request->input('id')) { | ||||||
|             $params['code'] = Helper::randomChar(8); |             if (!$params['code']) { | ||||||
|  |                 $params['code'] = Helper::randomChar(8); | ||||||
|  |             } | ||||||
|             if (!Coupon::create($params)) { |             if (!Coupon::create($params)) { | ||||||
|                 abort(500, '创建失败'); |                 abort(500, '创建失败'); | ||||||
|             } |             } | ||||||
|   | |||||||
| @@ -13,7 +13,8 @@ class CouponSave extends FormRequest | |||||||
|         'started_at' => 'required|integer', |         'started_at' => 'required|integer', | ||||||
|         'ended_at' => 'required|integer', |         'ended_at' => 'required|integer', | ||||||
|         'limit_use' => 'nullable|integer', |         'limit_use' => 'nullable|integer', | ||||||
|         'limit_plan_ids' => 'nullable|array' |         'limit_plan_ids' => 'nullable|array', | ||||||
|  |         'code' => '' | ||||||
|     ]; |     ]; | ||||||
|     /** |     /** | ||||||
|      * Get the validation rules that apply to the request. |      * Get the validation rules that apply to the request. | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user