<?php namespace Lightscale\LaralightSvg; use Lightscale\LaralightSvg\Http\Controllers\SvgController; use Lightscale\LaralightSvg\Console\Commands; use Illuminate\Foundation\Console\AboutCommand; use Illuminate\Support\ServiceProvider; use Illuminate\Support\Facades\Route; class SvgServiceProvider extends ServiceProvider { const NAMESPACE = 'laralight-svg'; const ROOT_PATH = __DIR__ . '/..'; public $singletons = [ SvgService::class, ]; public function boot() { AboutCommand::add('Laralight SVG', fn() => [ 'Version' => 'dev' ]); $this->mergeConfigFrom(static::ROOT_PATH . '/config/svg.php', 'svg'); $this->loadViewsFrom(static::ROOT_PATH . '/resources/views', static::NAMESPACE); $this->publishes([ static::ROOT_PATH . '/config/svg.php' => config_path('svg.php'), ], static::NAMESPACE . '-config'); $this->registerRoutes(); if ($this->app->runningInConsole()) { $this->registerCommands(); } } public function registerRoutes() { Route::get($this->app['config']->get('svg.svg_route'), [SvgController::class, 'serveSvg']) ->name('laralight-svg.serve-svg'); } public function registerCommands() { $this->commands([ Commands\SvgClearState::class ]); } }