/** * 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')); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $reason = DoseModificationReason::findOrFail($id); $reason->delete(); return redirect()->route('dosemodificationreasons.index')->with('success-message', 'Dose Calculation Type deleted.'); }
/** * Show the form for creating a new resource in ajax modal. * * @return \Illuminate\Http\Response */ public function addReasonAjax(Request $request) { if ($request->isMethod('post')) { $this->validate($request, ['name' => 'required']); $input = $request->all(); DoseModificationReason::create($input); return redirect()->route('ppos.create')->with('success-message', 'Regimen list updated'); } return view('ppos.add_reason_ajax'); }