| 
									
										
										
										
											2021-03-17 01:14:03 +08: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-27 09:48:05 +08:00
										 |  |  |         // Register the ThemeService as a singleton
 | 
					
						
							|  |  |  |         $this->app->singleton(ThemeService::class, fn ($app) => new ThemeService()); | 
					
						
							| 
									
										
										
										
											2021-03-17 01:14:03 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Bootstrap services. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return void | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function boot() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2022-09-27 09:48:05 +08:00
										 |  |  |         // Boot up the theme system
 | 
					
						
							| 
									
										
										
										
											2021-03-17 01:14:03 +08:00
										 |  |  |         $themeService = $this->app->make(ThemeService::class); | 
					
						
							|  |  |  |         $themeService->readThemeActions(); | 
					
						
							|  |  |  |         $themeService->dispatch(ThemeEvents::APP_BOOT, $this->app); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |