Created
July 20, 2020 23:57
-
-
Save codemonkey76/d35b2ed332f4b04811ba83eed54552c6 to your computer and use it in GitHub Desktop.
FusionApiProvider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Providers; | |
use App\Services\FusionApiService; | |
use Illuminate\Contracts\Support\DeferrableProvider; | |
use Illuminate\Support\ServiceProvider; | |
use Illuminate\Contracts\Config\Repository as Config; | |
class FusionApiProvider extends ServiceProvider implements DeferrableProvider | |
{ | |
/** | |
* @var Config | |
*/ | |
private Config $config; | |
/** | |
* Register services. | |
* | |
* @return void | |
*/ | |
public function register() | |
{ | |
$this->app->bind('FusionApiService',function() { | |
return new FusionApiService( | |
$this->config->get('fusionapi.api_base_url'), | |
$this->config->get('fusionapi.api_user'), | |
$this->config->get('fusionapi.api_password')); | |
}); | |
} | |
public function __construct($app, Config $config) | |
{ | |
parent::__construct($app); | |
$this->config = $config; | |
} | |
public function provides() | |
{ | |
return ['App\Services\FusionApiService']; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment