Skip to content

Commit 0899e42

Browse files
authored
Create ApiPostcodeServiceProvider.php
1 parent af24f8d commit 0899e42

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

ApiPostcodeServiceProvider.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
/*
3+
* (c) Api Postcode <info@api-postcode.nl>
4+
*
5+
* For the full copyright and license information, please view the LICENSE
6+
* file that was distributed with this source code.
7+
*/
8+
namespace ApiPostcode;
9+
10+
use Illuminate\Support\ServiceProvider as AppServiceProvider;
11+
use ApiPostcode\Client\PostcodeClient;
12+
13+
/**
14+
* Class ApiPostcodeServiceProvider
15+
*/
16+
class ApiPostcodeServiceProvider extends AppServiceProvider
17+
{
18+
/**
19+
* Indicates if loading of the provider is deferred.
20+
*
21+
* @var bool
22+
*/
23+
protected $defer = false;
24+
/**
25+
* {@inheritdoc}
26+
*/
27+
public function register()
28+
{
29+
// Postcode Client
30+
$this->app->singleton('api.postcode', function () {
31+
return new PostcodeClient(config('api-postcode.token'));
32+
});
33+
}
34+
/**
35+
* {@inheritdoc}
36+
*/
37+
public function boot()
38+
{
39+
$this->publishes([__DIR__ . '/config/api-postcode.php' => config_path('api-postcode.php')]);
40+
}
41+
}

0 commit comments

Comments
 (0)