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

增加商品分类


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

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

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

php
// 验证规则
protected $rule = [
    'status'=>'require|in:0,1',
    'name'=>'require',
    'category_id'=>'require|integer|>=:0|isExist:Category',
    'order'=>'integer',
];

protected $scene = [
    ...
    'save'=>['name','status','category_id','order'],
];

路由 router/admin.php

php
Route::post('category','admin.Category/save');