mirror of
https://github.com/v2board/v2board.git
synced 2025-06-14 05:37:49 +08:00
update
This commit is contained in:
@ -26,10 +26,16 @@ class CouponController extends Controller
|
||||
'limit_use'
|
||||
]);
|
||||
|
||||
$params['code'] = Helper::randomChar(8);
|
||||
if (!Coupon::create($params)) {
|
||||
abort(500, '创建失败');
|
||||
}
|
||||
if (!$request->input('id')) {
|
||||
$params['code'] = Helper::randomChar(8);
|
||||
if (!Coupon::create($params)) {
|
||||
abort(500, '创建失败');
|
||||
}
|
||||
} else {
|
||||
if (!Coupon::find($request->input('id'))->update($params)) {
|
||||
abort(500, '保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
return response([
|
||||
'data' => true
|
||||
|
Reference in New Issue
Block a user