Skip to content
关注公众号,获取新课通知

修改运费模板策略


控制器 app/controller/admin/ExpressValue.php

php
public function update(Request $request, $id)
{
    $param = $request->param();
    $res = $request->Model->save($param);
    return showSuccess($res);
}

验证器 app/validate/admin/ExpressValue.php

php
// 验证规则
protected $rule = [     	'id'=>'require|integer|>:0|isExist:ExpressValue',
    'page'=>'require|integer|>:0',
	'express_id'=>'require|integer|>=:0|isExist:Express,false',
    'region'=>'require|array',
    'first'=>'require|integer|>=:0',
    'first_price'=>'require|float|>=:0',
    'add'=>'require|integer|>=:0',
    'add_price'=>'require|float|>=:0',
];

protected $scene = [
    // ...
    'update'=>['id','express_id','region','first','first_price','add','add_price'],
];

路由 router/admin.php

php
Route::post('express_value/:id','admin.ExpressValue/update');