/** * Blog */ function blog_show($year, $month, $slug) { ////////////// // API DATA // ////////////// $article = API::GetArticle($year, $month, $slug); if (!$article) { return app()->abort(404); } ////////////////////// // GET RELATED TOUR // ////////////////////// if ($article->tags) { unset($query_data); $query_data['scheduled_since'] = \Carbon\Carbon::now()->format('Y-m-d'); foreach ($article->tags as $tag) { if (str_is('destination', $tag->type)) { $query_data['tags_destination'][] = $tag->tag; } } $query_data['skip'] = 0; $query_data['take'] = 10; $query_data['mode'] = 'latest'; $query_data['with_travel_agent'] = true; $related_tours = API::getLatestTours($query_data); } else { unset($query_data); $query_data['scheduled_since'] = \Carbon\Carbon::now()->format('Y-m-d'); $query_data['skip'] = 0; $query_data['take'] = 10; $query_data['mode'] = 'latest'; $query_data['with_travel_agent'] = true; $related_tours = API::getLatestTours($query_data); } ////////////////// // GET FEATURED // ////////////////// $webconfig = API::GetWebConfig(); ////////////////////////// // GET LATEST ARTICLES // ////////////////////////// $latest_articles = API::GetLatestArticles(0, 6); if (isset($article->images[0]->path)) { $this->layout->metas['og:image'] = $article->images[0]->path; } $this->layout->metas['og:title'] = $article->title . ' - Capcus.id'; ////////////////////// // Create Page View // ////////////////////// $this->layout->page = view($this->version . '.blog_detail'); $this->layout->page->article = $article; $this->layout->page->latest_articles = $latest_articles['data']; $this->layout->page->webconfig = $webconfig; $this->layout->page->related_tours = $related_tours; $this->layout->title = $article->title . ' - Capcus.id'; return $this->layout; }