/** * delete all selected programs at once * @param SupportprogramsApplication $SubProgModel Supportprograms model * @param Request $req CreateUserRequest $request we validate the data sent from the form in this class before we continue our logic * @return return to the program index view index.blade.php */ public function deletebulk(SupportprogramsApplication $SubProgModel, Request $req) { // if the table_records is empty we redirect to the support programs index if (!$req->has('table_records')) { return redirect()->route('supportprograms.index'); } // we delete all the programs with the ids $ids $SubProgModel->destroy($req->input('table_records')); // we redirect to the support programs index view with a success message return redirect()->route('supportprograms.index')->with('success', trans('supportprograms::programs.delete_bulk_success')); }