forked from IsraelOrtuno/pipedrive
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPipedriveServiceProvider.php
More file actions
44 lines (36 loc) · 1.22 KB
/
PipedriveServiceProvider.php
File metadata and controls
44 lines (36 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
namespace Devio\Pipedrive;
use Devio\Pipedrive\Exceptions\PipedriveException;
use Illuminate\Support\ServiceProvider;
class PipedriveServiceProvider extends ServiceProvider
{
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app->booting( function () {
$loader = \Illuminate\Foundation\AliasLoader::getInstance();
$loader->alias( 'Pipedrive', 'Devio\Pipedrive\PipedriveFacade' );
} );
$this->app->singleton(Pipedrive::class, function ($app) {
$token = $app['config']->get('services.pipedrive.token');
$uri = $app['config']->get('services.pipedrive.uri') ?: 'https://api.pipedrive.com/v1/';
$guzzleVersion = $app['config']->get('services.pipedrive.guzzle_version') ?: 6;
if (! $token) {
throw new PipedriveException('Pipedrive was not configured in services.php configuration file.');
}
return new Pipedrive($token, $uri, $guzzleVersion);
});
$this->app->alias(Pipedrive::class, 'pipedrive');
}
/**
* @return array
*/
public function provides()
{
return ['pipedrive'];
}
}