diff --git a/src/RootServiceProvider.php b/src/RootServiceProvider.php index 01919dca..4dd479be 100644 --- a/src/RootServiceProvider.php +++ b/src/RootServiceProvider.php @@ -45,7 +45,7 @@ public function register(): void } $this->app->booted(static function (Application $app): void { - if ((! $app->environment('testing') && $app->runningInConsole()) || Root::shouldRun($app['request'])) { + if ($app->runningInConsole() || Root::shouldRun($app['request'])) { Root::run($app['request']); } }); diff --git a/src/Support/Facades/Resource.php b/src/Support/Facades/Resource.php index 6902137b..311d4d14 100644 --- a/src/Support/Facades/Resource.php +++ b/src/Support/Facades/Resource.php @@ -28,9 +28,11 @@ public static function register(string $key, Item $item): void $request = RootRequest::createFrom(static::getFacadeApplication()['request']); - static::getFacadeRoot()->put($key, $item); + if (! static::getFacadeRoot()->has($key)) { + static::getFacadeRoot()->put($key, $item); - $item->registered($request); + $item->registered($request); + } } /**