123movies-seo/app/Providers/ApiServiceProvider.php

49 lines
1 KiB
PHP
Raw Permalink Normal View History

2024-08-24 23:08:42 +03:00
<?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()
{
//
}
}