/**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function get_recommend($origin = "cebu", $destination = "paris")
 {
     // $data = \Input::all();
     /**
      * $origin and $destination pwede ra e static
      * tang tanga lang ang parameter na $request
      */
     // $origin = \Input::get('origin');
     // $destination = \Input::get('destination');
     // $origin = "cebu";
     // $destination = "manila";
     $origin = urlencode($origin);
     $destination = urlencode($destination);
     /**
      * $url = API url
      * kani ray ilisi earl
      */
     $url = "http://free.rome2rio.com/api/1.2/json/Search?key=nKYL3BZS&oName=" . $origin . "&dName=" . $destination;
     $ch = curl_init($url);
     curl_setopt($ch, CURLOPT_TIMEOUT, 5);
     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     $data = curl_exec($ch);
     $data = json_decode($data);
     // dd($data);
     $airports = [];
     if (isset($data->airports)) {
         foreach ($data->airports as $airport) {
             $airports[$airport->code] = $airport->pos;
         }
     }
     // dd($data);
     // start debug
     $routes = \Rome2RioData::getRoutes($data, 0);
     // dd($routes);
     $segments = \Rome2RioData::getSegments($routes);
     foreach ($segments as $value) {
         if ($value->kind == "flight") {
             $value = Rome2Rio::convertToFlightSegment($value, $data);
             $flightpath = Rome2Rio::getFlightPath($airports[$value->sCode], $airports[$value->tCode]);
             $value->{"path"} = $flightpath;
         }
     }
     foreach ($segments as &$segment) {
         $segment->mode = $segment->kind;
         unset($segment->kind);
         $segment->origin_name = $segment->sName;
         unset($segment->sName);
         $segment->destination_name = $segment->tName;
         unset($segment->tName);
         $segment->origin_pos = $segment->sPos;
         unset($segment->sPos);
         $segment->destination_pos = $segment->tPos;
         unset($segment->tPos);
     }
     curl_close($ch);
     return $segments;
     // dd($segments);
     // dd($segments);
     //end debug
     // dd($data,$ch);
     // return response()->json([$request->all(),$data],'200');
 }