File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ public function getQueryLog(): Collection
144144 return $ this ->queryLog ?->all() ?? new Collection ();
145145 }
146146
147- public static function fromConfig (array $ config ): static
147+ public static function fromConfig (array $ config, mixed $ handler = null ): static
148148 {
149149 $ builder = (new ClientBuilder ())
150150 ->setHosts ($ config ['hosts ' ])
@@ -157,6 +157,10 @@ public static function fromConfig(array $config): static
157157 $ builder ->setBasicAuthentication ($ username , $ password );
158158 }
159159
160+ if (!is_null ($ handler )) {
161+ $ builder ->setHandler ($ handler );
162+ }
163+
160164 return new static ($ builder ->build ());
161165 }
162166
Original file line number Diff line number Diff line change @@ -29,7 +29,12 @@ public function register(): void
2929
3030 $ this ->app ->singleton (
3131 ElasticClient::class,
32- fn (Application $ app ) => ElasticClient::fromConfig ($ app ['config ' ]['laravel-elastic-query.connection ' ])
32+ fn (Application $ app ) => ElasticClient::fromConfig ($ app ['config ' ]['laravel-elastic-query.connection ' ], $ this -> getElasticClientHandler () )
3333 );
3434 }
35+
36+ protected function getElasticClientHandler (): ?callable
37+ {
38+ return null ;
39+ }
3540}
You can’t perform that action at this time.
0 commit comments