/** * Run the database seeds. * * @return void */ public function run() { DB::table('medications')->delete(); $medication = new Medication(['name' => 'Penacillin']); $medication->save(); $medication = new Medication(['name' => 'Amoxacillin']); $medication->save(); $medication = new Medication(['name' => 'Pseudoephedrine']); $medication->save(); }
public function saveObject(Request $request) { if (isset($request->id) && !empty($request->id)) { $object = Medication::where('id', $request->id)->first(); } else { $object = new Medication(); } $object->patient_id = $request->patient_id; $object->medicine_id = $request->medicine_id; $object->notes = $request->notes; $object->save(); return 200; }
public function store(CreateMedicationRequest $request) { $input = Request::all(); $input['user_id'] = Auth::user()->id; Medication::create($input); // Medication::create($request->all()); return redirect('medications'); }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $tags = Medication::personalize()->lists('name', 'name'); return view('batch.create', compact('tags')); }
private function findById($id) { return Medication::find($id); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { Medication::destroy($id); alert()->success('', 'Medication successfully deleted!'); return redirect('medication'); }