mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 17:49:11 +08:00
add custom coupon code
This commit is contained in:
parent
80e6fb7186
commit
6324645f08
@ -28,7 +28,9 @@ class CouponController extends Controller
|
||||
$params['limit_plan_ids'] = json_encode($params['limit_plan_ids']);
|
||||
}
|
||||
if (!$request->input('id')) {
|
||||
$params['code'] = Helper::randomChar(8);
|
||||
if (!$params['code']) {
|
||||
$params['code'] = Helper::randomChar(8);
|
||||
}
|
||||
if (!Coupon::create($params)) {
|
||||
abort(500, '创建失败');
|
||||
}
|
||||
|
@ -13,7 +13,8 @@ class CouponSave extends FormRequest
|
||||
'started_at' => 'required|integer',
|
||||
'ended_at' => 'required|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.
|
||||
|
Loading…
Reference in New Issue
Block a user