Ejemplo n.º 1
0
 function tour_detail($travel_agent, $year, $slug)
 {
     //////////////
     // API DATA //
     //////////////
     $tour = API::getTour($travel_agent, $year, $slug);
     if (!$tour) {
         app()->abort(404);
     }
     ////////////////////////
     // Check Published_at //
     ///////////////////////
     $published_at = \Carbon\Carbon::parse($tour->published_at);
     $now = \Carbon\Carbon::now();
     if (count($tour->cheapest_upcoming_schedules) == 0) {
         $info = 'Tour tidak berlaku karena jadwal keberangkatan tidak tersedia';
     }
     ///////////////////////
     // GET RELATED TOUR //
     //////////////////////
     $related_tours = $tour->related_tours;
     foreach ($related_tours as $type => $tours) {
         foreach ($tours as $k => $v) {
             $related_tours->{$type}[$k]->cheapest_upcoming_schedules = API::get_cheapest_upcoming_schedules_to_tour($v);
         }
     }
     //////////////////////
     // Create Page View //
     //////////////////////
     $this->layout->page = view($this->version . '.tour_detail');
     $this->layout->page->data = $tour;
     $this->layout->info = $info;
     if (isset($tour->images[0]->path)) {
         $this->layout->metas['og:image'] = $tour->images[0]->path;
     }
     $this->layout->metas['og:title'] = "Paket Tour " . $tour->name . ' oleh ' . $tour->travel_agent->name . ' - Capcus.id';
     $this->layout->title = "Paket Tour " . $tour->name . ' oleh ' . $tour->travel_agent->name . ' - Capcus.id';
     return $this->layout;
 }