Ejemplo n.º 1
0
 public function getSitemapVideos()
 {
     $videos = Youtube::orderBy('created_at', 'desc')->get();
     foreach ($videos as $video) {
         if ($video->category_id == 1) {
             $modpack = $video->modpack;
             $version = $modpack->version;
             if (!$modpack) {
                 break;
             }
             $friendly_name = Str::slug($video->channel_title);
             $url_version = preg_replace('/\\./', '-', $version->name);
             $this->sitemap->add(URL::to('modpack/' . $url_version . '/' . $modpack->slug . '/lets-play/' . $video->id . '-' . $friendly_name));
         } elseif ($video->category_id == 2) {
             $mod = $video->mod;
             if (!$mod) {
                 break;
             }
             $friendly_name = Str::slug($video->channel_title);
             $this->sitemap->add(URL::to('mod/' . $mod->slug . '/spotlight/' . $video->id . '-' . $friendly_name));
         } elseif ($video->category_id == 3) {
             $mod = $video->mod;
             if (!$mod) {
                 break;
             }
             $friendly_name = Str::slug($video->channel_title);
             $this->sitemap->add(URL::to('mod/' . $mod->slug . '/tutorial/' . $video->id . '-' . $friendly_name));
         } else {
             break;
         }
     }
     return $this->sitemap->render('xml');
 }