<?php namespace Lightscale\LaralightSvg\Http\Controllers; use Lightscale\LaralightSvg\SvgService; use Illuminate\Routing\Controller; use Illuminate\Http\Request; class SvgController extends Controller { public function serveSvg(SvgService $svg, Request $request, string $collection) { $collection = $svg->getCollection($collection); if ($collection === null) abort(404); $svgContent = $collection->getSvg(); if ($svgContent === null) abort(404); return response( $svgContent, 200, [ 'Content-Type' => 'image/svg+xml', ] ); } }