Exemplo n.º 1
0
 public function apiviewTrip($itineraryKey, $tripId)
 {
     $tripKey = Trip::getTripKey($tripId);
     if (empty($tripKey)) {
         return json_encode("Wrong Trip Id");
     }
     if (Hash::check($itineraryKey, $tripKey[0]->trip_key)) {
         $itineraryKey = $tripKey[0]->trip_key;
     } else {
         return json_encode("Key did not match");
     }
     $tripItinerary = Trip::getTrip($itineraryKey);
     $pitStops = $tripItinerary[0]->trip_object;
     $pitStops = json_decode($pitStops);
     for ($i = 0; $i < sizeof($pitStops); $i++) {
         $places = $pitStops[$i]->places;
         if ($pitStops[$i]->places == '') {
             $places = null;
         }
         $pitStopObject[$i] = ['city' => $pitStops[$i]->city, 'formatted_address' => $pitStops[$i]->formatted_address, 'lat' => $pitStops[$i]->lat, 'lng' => $pitStops[$i]->lng, 'placeId' => $pitStops[$i]->placeId, 'places' => $places];
     }
     $pitStops = $pitStopObject;
     $pitStops = str_replace("'", "", json_encode($pitStops));
     return $pitStops;
     /*$baseURL = '../../../public/';	    		    
     		return \View::make('viewtrip')->with('pitStops', $pitStops)->with('trip', 'trip')->with('baseURL', $baseURL);*/
 }