/** * Mass delete function from index page * @param Request $request * * @return mixed */ public function massDelete(Request $request) { if ($request->get('toDelete') != 'mass') { $toDelete = json_decode($request->get('toDelete')); Slider::destroy($toDelete); } else { Slider::whereNotNull('id')->delete(); } return redirect()->route('admin.slider.index'); }