49 lines
1 KiB
PHP
49 lines
1 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace App\Providers;
|
||
|
|
||
|
use App\Services\ApiClient;
|
||
|
use Illuminate\Contracts\Support\DeferrableProvider;
|
||
|
use Illuminate\Support\ServiceProvider;
|
||
|
|
||
|
class ApiServiceProvider extends ServiceProvider
|
||
|
{
|
||
|
/**
|
||
|
* Register services.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function register()
|
||
|
{
|
||
|
$this->app->singleton(ApiClient::class, function ($app) {
|
||
|
return new ApiClient(
|
||
|
$app['config']['services']['api']['api_url'],
|
||
|
$app['config']['services']['api']['per_page'],
|
||
|
$app['config']['services']['api']['domain_src'],
|
||
|
$app['config']['services']['api']['use_cache'],
|
||
|
$app['config']['services']['api']['cache_ttl'],
|
||
|
);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Get the services provided by the provider.
|
||
|
*
|
||
|
* @return array
|
||
|
*/
|
||
|
public function provides()
|
||
|
{
|
||
|
return [ApiClient::class];
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Bootstrap services.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function boot()
|
||
|
{
|
||
|
//
|
||
|
}
|
||
|
}
|