public function deleteBulk(Request $request) { // if the table_records is empty we redirect to the subject index if (!$request->has('table_records')) { return redirect()->route('f.category.index'); } // we get all the ids and put them in a variable $ids = $request->input('table_records'); // we delete all the subject with the ids $ids $answer = QuestionsAnswers::find($ids[0]); QuestionsAnswers::destroy($ids); // we redirect to the user index view with a success message return redirect()->route('f.questionanswer.index', $answer->cat_id)->with('success'); }