blob: 9e9c5506353a75e5ab69e0efdb3c7d4ac1f66935 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 | <?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',
            ]
        );
    }
}
 |