/**
  * Returns home page of all the wells, the index.
  * 
  * @return index.blade.php View
  */
 public function index()
 {
     /* 
     Sets the Well Variable to null, or to the current users well. Used
     for populating the well modal (not model, I'm talking about the 
     bootstrap component) with information 
     */
     if (Auth::check()) {
         if (Address::where('user_id', Auth::user()->id)->first()) {
             $well = Address::where('user_id', Auth::user()->id)->first();
         } else {
             $well = null;
         }
     }
     //Gets all the Addresses from the database, then puts them into JSON so Javascript can read it.
     $addresses = Address::all();
     $addresses = json_encode($addresses);
     return View::make('index', compact('addresses', 'well'));
 }
Exemple #2
0
 public function index()
 {
     $aryDrug = Drug::all();
     $objJson = array();
     foreach ($aryDrug as $drug) {
         switch ($drug->type) {
             case 1:
                 $objJson[] = array("type" => $drug->type, "defaults" => array("morning" => $drug->morning, "lunch" => $drug->lunch, "afternoon" => $drug->afternoon, "night" => $drug->night), 'total' => -1);
                 break;
             case 2:
             case 3:
                 $objJson[] = array("type" => $drug->type, "fixed" => $drug->fixed, "special" => $drug->special);
                 break;
             case 4:
                 $objJson[] = array("type" => $drug->type, "fixed" => $drug->fixed);
                 break;
         }
     }
     return View::make('medical.medical', array('address' => Address::all(), 'diseases' => Disease::all(), 'drugs' => Drug::all(), 'current_day' => Config::get('constants.current_day', 3), 'max_day' => Config::get('constants.max_day', 7), 'drug' => json_encode($objJson)));
 }
Exemple #3
0
 public function pod()
 {
     $addresses = \Address::all();
     return View::make('support/pod', compact('addresses'));
 }
 public function index()
 {
     return Response::json(array('address' => Address::all(), 'diseases' => Disease::all(), 'drugs' => Drug::all(), 'current_day' => Config::get('constants.current_day', 3), 'max_day' => Config::get('constants.max_day', 7)));
 }
 /**
  * Display a listing of addresses
  *
  * @return Response
  */
 public function index()
 {
     $addresses = Address::all();
     return View::make('addresses.index', compact('addresses'));
 }
Exemple #6
0
    $newAddress->complement = $complement;
    $newAddress->neighborhood = $neighborhood;
    $newAddress->city = $city;
    $newAddress->state = $state;
    if ($newAddress->save()) {
        $data['msg'] = 'Address saved successfully!';
        $data['id'] = $newAddress->id;
    } else {
        $data['msg'] = 'An error occurred while saving the address!';
    }
    $contactList->response()->header('Content-Type', 'application/json');
    echo json_encode($data);
});
// Get all address to one contact
$contactList->get("/addresses", function () use($contactList) {
    $addresses = Address::all();
    $contactList->response()->header('Content-Type', 'application/json');
    echo json_encode(objectToArray(json_decode($addresses)));
});
// Get specific address
$contactList->get("/addresses/:id", function ($id) use($contactList) {
    $addresses = Address::find($id);
    $contactList->response()->header('Content-Type', 'application/json');
    echo json_encode(objectToArray(json_decode($addresses)));
});
// Add new address
$contactList->post("/addresses", function () use($contactList) {
    $contactId = $contactList->request->params('contactid');
    $zipcode = $contactList->request->params('zipcode');
    $address = $contactList->request->params('address');
    $complement = $contactList->request->params('complement');