diff --git a/src/ElasticsearchServiceProvider.php b/src/ElasticsearchServiceProvider.php index 5771ea6..5879bcd 100755 --- a/src/ElasticsearchServiceProvider.php +++ b/src/ElasticsearchServiceProvider.php @@ -203,9 +203,9 @@ protected function registerClientFactory(): void ClientFactory::class ); - $this->app->when(ClientFactoryInterface::class) - ->needs(LoggerInterface::class) - ->give('elasticsearch.logger'); + $this->app->bind(ClientFactory::class, fn(Application $app) => new ClientFactory( + $app->make('elasticsearch.logger') + )); $this->app->alias( ClientFactoryInterface::class,