From febbe05a124ae199a86c11fecc8441629b3df55b Mon Sep 17 00:00:00 2001 From: Ollie Read Date: Sat, 23 Nov 2024 11:47:43 +0000 Subject: [PATCH] refactor: Boot service override _AFTER_ the application has booted Remove the manual booting of service overrides from the SproutServiceProvider::boot() method and add to the Application::booted() lifecycle event --- src/SproutServiceProvider.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/SproutServiceProvider.php b/src/SproutServiceProvider.php index f6c1604..a3e3368 100644 --- a/src/SproutServiceProvider.php +++ b/src/SproutServiceProvider.php @@ -31,6 +31,7 @@ public function register(): void $this->registerManagers(); $this->registerMiddleware(); $this->registerRouteMixin(); + $this->registerServiceOverrideBooting(); } private function registerSprout(): void @@ -78,13 +79,17 @@ protected function registerRouteMixin(): void Router::mixin(new RouterMethods()); } + protected function registerServiceOverrideBooting(): void + { + $this->app->booted($this->sprout->bootOverrides(...)); + } + public function boot(): void { $this->publishConfig(); $this->registerServiceOverrides(); $this->registerEventListeners(); $this->registerTenancyBootstrappers(); - $this->bootServiceOverrides(); } private function publishConfig(): void @@ -128,9 +133,4 @@ private function registerTenancyBootstrappers(): void $events->listen(CurrentTenantChanged::class, $bootstrapper); } } - - private function bootServiceOverrides(): void - { - $this->sprout->bootOverrides(); - } }