Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

Commit a31289f

Browse files
authored
Bind GuzzleHttpClient as default client for Unleash. (#29)
1 parent c579789 commit a31289f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/ServiceProvider.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
use Illuminate\Support\Facades\Blade;
66
use Illuminate\Support\ServiceProvider as IlluminateServiceProvider;
7+
use MikeFrancis\LaravelUnleash\Unleash;
8+
use MikeFrancis\LaravelUnleash\Client;
9+
use GuzzleHttp\ClientInterface;
710

811
class ServiceProvider extends IlluminateServiceProvider
912
{
@@ -15,9 +18,9 @@ class ServiceProvider extends IlluminateServiceProvider
1518
public function register()
1619
{
1720
$this->mergeConfigFrom($this->getConfigPath(), 'unleash');
21+
$this->app->when(Unleash::class)->needs(ClientInterface::class)->give(Client::class);
1822
$this->app->singleton('unleash', function ($app) {
19-
$client = $app->make(Client::class);
20-
return $app->make(Unleash::class, ['client' => $client]);
23+
return $app->make(Unleash::class);
2124
});
2225
}
2326

0 commit comments

Comments
 (0)