exists($theme)) { abort(404); } $fullPath = $themes->path($theme).'/assets/'.$path; if (! File::isFile($fullPath)) { abort(404); } return response(File::get($fullPath), 200, [ 'Content-Type' => $this->mimeType($fullPath), 'Cache-Control' => 'public, max-age=86400', ]); } private function mimeType(string $path): string { $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION)); return match ($ext) { 'css' => 'text/css', 'js' => 'application/javascript', 'png' => 'image/png', 'jpg', 'jpeg' => 'image/jpeg', 'gif' => 'image/gif', 'svg' => 'image/svg+xml', 'woff' => 'font/woff', 'woff2' => 'font/woff2', 'ico' => 'image/x-icon', default => 'application/octet-stream', }; } }