コード例 #1
0
 /**
  * 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();
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 public function store(CreateMedicationRequest $request)
 {
     $input = Request::all();
     $input['user_id'] = Auth::user()->id;
     Medication::create($input);
     // Medication::create($request->all());
     return redirect('medications');
 }
コード例 #4
0
 /**
  * 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'));
 }
コード例 #5
0
 private function findById($id)
 {
     return Medication::find($id);
 }
コード例 #6
0
 /**
  * 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');
 }