Пример #1
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create($medid = null)
 {
     if ($medid) {
         $medication = Medication::select('name', 'id')->find($medid);
         $medications = null;
     } else {
         $medication = null;
         $medications = Medication::lists('name', 'id');
     }
     return view('lucodes.create', compact('medication', 'medications'));
 }
Пример #2
0
 /**
  * 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'));
 }
Пример #3
0
 /**
  * Show the form for creating a new resource in ajax modal.
  *
  * @return \Illuminate\Http\Response
  */
 public function addLucodeAjax(Request $request)
 {
     $medication = null;
     $medications = Medication::lists('name', 'id');
     if ($request->isMethod('post')) {
         $input = $request->all();
         Lucode::create($input);
         return redirect()->back()->with('success-message', 'LU code list updated');
     }
     return view('ppo_items.add_lucode_ajax', compact('medication', 'medications'));
 }
Пример #4
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $medication = Medication::findOrFail($id);
     $medication->delete();
     return redirect()->route('medications.index')->with('success-message', 'Medication deleted.');
 }