Coupon::all() ]); } public function save (CouponSave $request) { $params = $request->only([ 'name', 'type', 'value', 'expired_at', 'limit_use' ]); $params['code'] = Helper::guid(); if (!Coupon::create($params)) { abort(500, '创建失败'); } return response([ 'data' => true ]); } }