From 1af85726d3b0ab9676f6f159c747c5e4a4691dea Mon Sep 17 00:00:00 2001 From: Zlatoslav Desyatnikov Date: Tue, 23 Feb 2021 13:14:03 +0300 Subject: [PATCH] Register ContainerInterface, StoreInterface and ResolverInterface as singleton. Resolves #589 --- src/ServiceProvider.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index 2520bc9f..331e48b9 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -229,7 +229,7 @@ protected function bindRouteRegistrar() * * @return void */ - protected function bindInboundRequest() + protected function bindInboundRequest(): void { $this->app->singleton(Route::class, function (Application $app) { return new Route( @@ -238,15 +238,15 @@ protected function bindInboundRequest() ); }); - $this->app->bind(StoreInterface::class, function () { + $this->app->singleton(StoreInterface::class, function () { return json_api()->getStore(); }); - $this->app->bind(ResolverInterface::class, function () { + $this->app->singleton(ResolverInterface::class, function () { return json_api()->getResolver(); }); - $this->app->bind(ContainerInterface::class, function () { + $this->app->singleton(ContainerInterface::class, function () { return json_api()->getContainer(); });