My service provider has below code:
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\ServiceProvider;
use App\Domains\Import\Listeners\ImportEventListeners;
use GuzzleHttp\Client as GuzzleClient;
class GuzzleServiceProvider extends ServiceProvider
{
/**
* Register services.
*
* @return void
*/
public function register()
{
Event::subscribe(ImportEventListeners::class);
}
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
$this->app->bind('GuzzleHttp\Client', function () {
return new GuzzleClient;
});
}
}
I want to use Guzzle service in my listener but it's giving error
<?php
namespace App\Domains\Import\Listeners;
use GuzzleHttp\Client as GuzzleClient;
class ImportEventListeners implements ShouldQueue
{
public function __construct()
{
}
public function handle(Event $event, GuzzleClient $guzzleClient)
{
$this->guzzleClient = $guzzleClient;
dd($this->guzzleClient);
}
}