/**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     //
     $dataAccess = new MedMng();
     $dataAccess->requestUpdate($request["data"], $id);
     return Response::json(array('error' => false, 'data' => array("Data Saved")), 200);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $dataAccess = new MedMng();
     $data = $request["data"];
     $dataAccess->saveMedications($data["name"], $data["quantity"]);
     return Response::json(array('error' => false, 'data' => array("Data Saved")), 200);
     //'name: example'
     //'quantitiy: 2'
 }
 /**
  * update a request to approved/declined.
  *
  * @param  \Illuminate\Http\Request  $request
  */
 public function update(Request $request)
 {
     $dataAccess = new MedMng();
     $status = 'pending';
     if ($request->action == 'approved') {
         $status = 'approved';
     } else {
         if ($request->action == 'declined') {
             $status = 'declined';
         }
     }
     $list = ['quantity' => $request->quantity, 'status' => $status, 'notes' => $request->notes];
     $dataAccess->requestUpdate($list, $request->id);
     return back();
 }
 public function index()
 {
     $dataAccess = new MedMng();
     $request = Request::create('/api/terms', 'GET');
     $response = Route::dispatch($request);
     $obj = json_decode($response->content(), true);
     $terms = $obj["data"];
     //$terms = $dataAccess->getTerms();
     if (\Request::has('search')) {
         $query = \Request::get('search');
         $results = $dataAccess->searchTerms($query);
         return \View::make('termslist')->with('terms', $results);
     }
     return \View::make('termslist')->with('terms', $terms);
 }
 public function store(Request $request)
 {
     $dataAccess = new MedMng();
     $dataAccess->saveMedications($request->name, $request->quantity);
     return redirect('/medications');
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $dataAccess = new MedMng();
     $terms = $dataAccess->getTerms();
     return Response::json(array('error' => false, 'data' => $terms), 200);
 }