2021-03-16 13:14:03 -04:00
|
|
|
<?php
|
|
|
|
|
2023-05-17 12:56:55 -04:00
|
|
|
namespace BookStack\App\Providers;
|
2021-03-16 13:14:03 -04:00
|
|
|
|
|
|
|
use BookStack\Theming\ThemeEvents;
|
|
|
|
use BookStack\Theming\ThemeService;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
|
|
|
|
class ThemeServiceProvider extends ServiceProvider
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Register services.
|
|
|
|
*/
|
2024-03-16 11:12:14 -04:00
|
|
|
public function register(): void
|
2021-03-16 13:14:03 -04:00
|
|
|
{
|
2022-09-26 21:48:05 -04:00
|
|
|
// Register the ThemeService as a singleton
|
|
|
|
$this->app->singleton(ThemeService::class, fn ($app) => new ThemeService());
|
2021-03-16 13:14:03 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Bootstrap services.
|
|
|
|
*/
|
2024-03-16 11:12:14 -04:00
|
|
|
public function boot(): void
|
2021-03-16 13:14:03 -04:00
|
|
|
{
|
2022-09-26 21:48:05 -04:00
|
|
|
// Boot up the theme system
|
2021-03-16 13:14:03 -04:00
|
|
|
$themeService = $this->app->make(ThemeService::class);
|
|
|
|
$themeService->readThemeActions();
|
|
|
|
$themeService->dispatch(ThemeEvents::APP_BOOT, $this->app);
|
|
|
|
}
|
|
|
|
}
|