/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $regimen = Regimen::findOrFail($id); $regimen->delete(); return redirect()->route('regimens.index')->with('success-message', 'Regimen deleted.'); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $ppo = Ppo::findOrFail($id); $regimens = Regimen::lists('name', 'id'); $diagnoses = Diagnosis::lists('name', 'id'); $reasons = DoseModificationReason::lists('name', 'id'); $diagnosesSelected = $ppo->diagnoses->pluck('id')->all(); $reasonsSelected = $ppo->reasons->pluck('id')->all(); return view('ppos.edit', compact('ppo', 'regimens', 'diagnosesSelected', 'diagnoses', 'reasons', 'reasonsSelected')); }
/** * Show the form for creating a new resource in ajax modal. * * @return \Illuminate\Http\Response */ public function addRegimenAjax(Request $request) { if ($request->isMethod('post')) { $this->validate($request, ['name' => 'required']); $input = $request->all(); Regimen::create($input); return redirect()->route('ppos.create')->with('success-message', 'Regimen list updated'); } return view('ppos.add_regimen_ajax'); }