$baseUrl, 'changefreq' => 'weekly', 'priority' => '1.0', 'lastmod' => now()->toW3cString(), ], [ 'loc' => "{$baseUrl}/privacy", 'changefreq' => 'monthly', 'priority' => '0.5', 'lastmod' => now()->toW3cString(), ], [ 'loc' => "{$baseUrl}/terms", 'changefreq' => 'monthly', 'priority' => '0.5', 'lastmod' => now()->toW3cString(), ], ]; $xml = ''."\n"; $xml .= ''."\n"; foreach ($urls as $url) { $xml .= ' '."\n"; $xml .= " {$url['loc']}\n"; $xml .= " {$url['lastmod']}\n"; $xml .= " {$url['changefreq']}\n"; $xml .= " {$url['priority']}\n"; $xml .= ' '."\n"; } $xml .= ''; return response($xml, 200) ->header('Content-Type', 'application/xml'); } }