On this page
修改商品分类
控制器 app/controller/admin/Category.php
php
public function update(Request $request, $id)
{
return showSuccess($request->Model->save($request->param()));
}
验证器 app/validate/admin/Category.php
php
// 验证规则
protected $rule = [
// ...
'id'=>'require|integer|>:0|isExist:Category',
'status'=>'require|in:0,1',
'name'=>'require',
'category_id'=>'require|integer|>=:0|isExist:Category,false',
'order'=>'integer',
];
protected $scene = [
// ...
'update'=>['id','name','status','category_id','order'],
];
路由 router/admin.php
php
Route::post('category/:id','admin.Category/update');