47 lines
939 B
PHP
47 lines
939 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Providers;
|
||
|
|
||
|
use App\Services\TmdbClient;
|
||
|
use Illuminate\Contracts\Support\DeferrableProvider;
|
||
|
use Illuminate\Support\ServiceProvider;
|
||
|
|
||
|
class TmdbServiceProvider extends ServiceProvider
|
||
|
{
|
||
|
/**
|
||
|
* Register services.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function register()
|
||
|
{
|
||
|
$this->app->singleton(TmdbClient::class, function ($app) {
|
||
|
return new TmdbClient(
|
||
|
$app['config']['services']['tmdb']['key'],
|
||
|
$app['config']['services']['tmdb']['use_cache'],
|
||
|
$app['config']['services']['tmdb']['cache_ttl'],
|
||
|
);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Get the services provided by the provider.
|
||
|
*
|
||
|
* @return array
|
||
|
*/
|
||
|
public function provides()
|
||
|
{
|
||
|
return [TmdbClient::class];
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Bootstrap services.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function boot()
|
||
|
{
|
||
|
//
|
||
|
}
|
||
|
}
|