On this page
批量恢复商品
控制器 app/controller/admin/Goods.php
php
// 批量恢复
public function restore(){
$ids = request()->param('ids');
$res = $this->M->onlyTrashed()->where('id','in',$ids)->select();
$res->each(function($item){
$item->restore();
});
return showSuccess('ok');
}
验证器 app/validate/admin/Goods.php
php
// 验证规则
protected $rule = [
...
'ids'=>'require|array'
...
];
protected $scene = [
//...
'restore'=>['ids'],
];
路由 router/admin.php
php
Route::post('goods/restore','admin.goods/restore');