On this page
审核商品
控制器 app/controller/admin/Goods.php
php
// 审核商品
public function checkGoods(){
$request = request();
return showSuccess($request->Model->save([
'ischeck'=>$request->param('ischeck')
]));
}
验证器 app/validate/admin/Goods.php
php
// 验证规则
protected $rule = [
...
'id'=>'require|integer|>:0|isExist:Goods',
'ischeck'=>'require|in:0,1,2',
...
];
protected $scene = [
// ...
'checkGoods'=>['id','ischeck'],
];
路由 router/admin.php
php
Route::post('goods/:id/check','admin.goods/checkGoods');