public function getSitemapServers() { $modpacks = Modpack::orderBy('created_at', 'desc')->get(); $servers = Server::where('active', 1)->get(); //index $this->sitemap->add(URL::to('servers')); foreach ($modpacks as $modpack) { $this->sitemap->add(URL::to('servers/' . $modpack->slug)); } foreach ($servers as $server) { $this->sitemap->add(URL::to('server/' . $server->id . '/' . $server->slug), $server->updated_at); } return $this->sitemap->render('xml'); }
public function getStreams() { $streams_array = []; $modpacks = Modpack::orderBy('name')->with(array('twitchStreams' => function ($query) { $query->orderBy('viewers', 'desc'); }))->get(); foreach ($modpacks as $modpack) { if ($modpack->twitchStreams) { $streams_array[$modpack->name] = $modpack->twitchStreams; } } $title = 'Modpack Streams - ' . $this->site_name; $meta_description = 'Modpack Stream List. Find and watch a Twitch Stream for your favorite modpack.'; return View::make('twitch.streams', ['title' => $title, 'streams' => $streams_array, 'meta_description' => $meta_description]); }