path = '/tournaments/'.$tournament->id; $url->lastmod = $tournament->updated_at ? $tournament->updated_at : ($tournament->created_at ? $tournament->created_at : now()); $url->changefreq = $tournament->locked ? 'never' : 'daily'; $url->priority = $tournament->locked ? 0.5 : 1.0; $urls[] = $url; } foreach (Technique::where('index', true)->get() as $tech) { $url = new SitemapUrl(); $url->path = '/tech/'.rawurlencode($tech->name); $url->lastmod = $tech->updated_at ? $tech->updated_at : ($tech->created_at ? $tech->created_at : now()); $url->changefreq = 'monthly'; $url->priority = $tech->priority; $urls[] = $url; } return response()->view('sitemap', [ 'urls' => $urls, ])->header('Content-Type', 'text/xml'); } }