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

彻底删除商品


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

php
// 彻底删除
   public function destroy(){
   	$ids = request()->param('ids');
   	$res = $this->M->onlyTrashed()->where('id','in',$ids)->select();
   	$res->each(function($item){
   		$item->force()->delete();
   	});
   	return showSuccess('ok');
   }

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

php
// 验证规则
protected $rule = [
    ...
    'ids'=>'require|array'
    ...
];

protected $scene = [
    ...
    'destroy'=>['ids']
];

路由 router/admin.php

php
Route::post('goods/destroy','admin.goods/destroy');