/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $type = DoseCalculationType::findOrFail($id); $type->delete(); return redirect()->route('dosecalculationtypes.index')->with('success-message', 'Dose Calculation Type deleted.'); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id, Request $request) { $item = PpoItem::with('lucodes')->findOrFail($id); //because detail is not a db field, so we have to get() first then lists() $templates = PpoItem::where('medication_id', $item->medication_id)->get()->lists('detail', 'id')->toArray(); $templateSelected = $id; $lucodes = Lucode::where('medication_id', $item->medication_id)->get()->lists('detail', 'id')->toArray(); $lucodesSelected = $item->lucodes->pluck('id')->all(); $medications = Medication::lists('name', 'id'); $ppoSections = PpoSection::lists('name', 'id'); $ppos = Ppo::lists('name', 'id'); $doseCalculationTypes = DoseCalculationType::lists('name', 'id'); $doseUnits = DoseUnit::lists('name', 'id'); $doseRoutes = DoseRoute::lists('name', 'id'); $mitteUnits = MitteUnit::lists('name', 'id'); return view('ppo_items.edit', compact('templates', 'templateSelected', 'lucodes', 'lucodesSelected', 'item', 'medications', 'ppoSections', 'ppos', 'doseCalculationTypes', 'doseUnits', 'doseRoutes', 'mitteUnits')); }