模型应用程序/模型/国家/地区delete_all没有查询结果



我正在使用laravel和vuejs进行项目,问题是我试图选择多行并删除它们,错误是模型[App\Models\Country]delete_all没有查询结果我的路线链接

Route::delete('/delete_all','CountriesController@deleteAll');

国家控制器中的删除功能

public function deleteAll(Request $request){
$ids = $request->ids;
DB::table("countries")->whereIn('id',explode(",",$ids))->delete();
return response()->json('Selected Countries Deleted Successfully',200);
}

组件中的删除方法

delAll(){
axios.delete('/dashboard/countries/delete_all', {
ids: this.selected
}).then(response => {
toastr.success(response.data);
})
}

我在哪里能找到错误

正在尝试

DB::table("countries")->whereIn('id',explode(",",$ids))->get()->delete();

或简单

Countries::destroy(explode(",",$ids));

最新更新