2021-03-16 13:14:03 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace BookStack\Providers;
|
|
|
|
|
|
|
|
use BookStack\Theming\ThemeEvents;
|
|
|
|
use BookStack\Theming\ThemeService;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
|
|
|
|
class ThemeServiceProvider extends ServiceProvider
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Register services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function register()
|
|
|
|
{
|
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.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function boot()
|
|
|
|
{
|
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);
|
|
|
|
}
|
|
|
|
}
|