<?php
 namespace App\Providers; use App\Services\ThemeManager; use Illuminate\Support\Facades\View; use Illuminate\Support\ServiceProvider; class ThemeServiceProvider extends ServiceProvider { public function register(): void { $this->app->singleton(ThemeManager::class); } public function boot(): void { $themeManager = $this->app->make(ThemeManager::class); try { $activeTheme = $themeManager->getActive(); } catch (\Exception $e) { $activeTheme = 'default'; } if ($themeManager->exists($activeTheme)) { $viewsPath = $themeManager->getViewsPath($activeTheme); if (is_dir($viewsPath)) { $finder = $this->app['view']->getFinder(); $finder->prependLocation($viewsPath); } } View::share('activeTheme', $activeTheme); View::share('themeAssets', $themeManager->getAssets($activeTheme)); } } 