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

添加运费模板策略


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

php
public function save(Request $request)
{
    $res = $this->M->save($request->param());
    return showSuccess($res);
}

模型 app/model/ExpressValue.php

protected $json = ['region'];
protected $jsonAssoc = true;

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

php
// 验证规则
protected $rule = [
 
'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 = [
    // ...
    'save'=>['express_id','region','first','first_price','add','add_price'],
];

路由 router/admin.php

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