xmlFileResponse($path); } // 2. Published release (release management pipeline fallback). $published = $this->published->resolveIndex(); if ($published !== null) { return $this->renderer->xmlResponse($published['content']); } throw new NotFoundHttpException(); } public function show(string $name): Response|BinaryFileResponse { // 1. Static file. $path = public_path('sitemaps/' . $name . '.xml'); if (file_exists($path)) { return $this->xmlFileResponse($path); } // 2. Published release. $published = $this->published->resolveNamed($name); if ($published !== null) { return $this->renderer->xmlResponse($published['content']); } throw new NotFoundHttpException(); } private function xmlFileResponse(string $absolutePath): BinaryFileResponse { return response()->file($absolutePath, [ 'Content-Type' => 'application/xml; charset=UTF-8', 'Cache-Control' => 'public, max-age=' . max(60, (int) config('sitemaps.cache_ttl_seconds', 900)), ]); } }