public function deleteBulk($id, Request $req, Lesson $UserModel) { // if the table_records is empty we redirect to the users index if (!$req->has('table_records')) { return redirect()->route('lessons.index'); } // we get all the ids and put them in a variable $ids = $req->input('table_records'); // we delete all the lessons with the ids $ids $UserModel->destroy($ids); // we redirect to the user index view with a success message return redirect()->route('lessons.index', $id)->with('success'); }