/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required|unique:medications']);
     $input = $request->all();
     Medication::create($input);
     return redirect()->route('medications.index')->with('success-message', 'Medication created');
 }
Exemple #2
0
 /**
  * Show the form for creating a new resource in ajax modal.
  *
  * @return \Illuminate\Http\Response
  */
 public function addMedicationAjax(Request $request)
 {
     if ($request->isMethod('post')) {
         $this->validate($request, ['name' => 'required|unique:medications']);
         $input = $request->all();
         Medication::create($input);
         return redirect()->back()->with('success-message', 'Medication list updated');
     }
     return view('ppo_items.add_medication_ajax');
 }