13
13
14
14
use Geocoder \Geocoder ;
15
15
use Geocoder \Provider \ChainProvider ;
16
- use Illuminate \Support \ServiceProvider ;
17
16
18
17
/**
19
18
* Geocoder service provider
20
19
*
21
20
* @author Antoine Corcy <contact@sbin.dk>
22
21
*/
23
- class GeocoderServiceProvider extends ServiceProvider
22
+ class GeocoderServiceProvider extends \ Illuminate \ Support \ ServiceProvider
24
23
{
25
- /**
26
- * Indicates if loading of the provider is deferred.
27
- *
28
- * @var bool
29
- */
30
- protected $ defer = false ;
31
-
32
24
/**
33
25
* Bootstrap the application events.
34
26
*
35
27
* @return void
36
28
*/
37
29
public function boot ()
38
30
{
39
- $ this ->package ('toin0u/geocoder-laravel ' );
31
+ $ source = realpath (__DIR__ . '/../config/geocoder.php ' );
32
+
33
+ $ this ->publishes ([$ source => config_path ('geocoder.php ' )]);
34
+
35
+ $ this ->mergeConfigFrom ($ source , 'geocoder ' );
40
36
}
41
37
42
38
/**
@@ -47,15 +43,15 @@ public function boot()
47
43
public function register ()
48
44
{
49
45
$ this ->app ->singleton ('geocoder.adapter ' , function ($ app ) {
50
- $ adapter = $ app ['config ' ]->get ('geocoder-laravel:: adapter ' );
46
+ $ adapter = $ app ['config ' ]->get ('geocoder. adapter ' );
51
47
52
48
return new $ adapter ;
53
49
});
54
50
55
51
$ this ->app ->singleton ('geocoder.chain ' , function ($ app ) {
56
- $ providers = array () ;
52
+ $ providers = [] ;
57
53
58
- foreach ($ app ['config ' ]->get ('geocoder-laravel:: providers ' ) as $ provider => $ arguments ) {
54
+ foreach ($ app ['config ' ]->get ('geocoder. providers ' ) as $ provider => $ arguments ) {
59
55
if (0 !== count ($ arguments )) {
60
56
$ providers [] = call_user_func_array (
61
57
function ($ arg1 = null , $ arg2 = null , $ arg3 = null , $ arg4 = null ) use ($ app , $ provider ) {
@@ -88,6 +84,6 @@ function ($arg1 = null, $arg2 = null, $arg3 = null, $arg4 = null) use ($app, $pr
88
84
*/
89
85
public function provides ()
90
86
{
91
- return array ( 'geocoder ' , 'geocoder.adapter ' , 'geocoder.chain ' ) ;
87
+ return [ 'geocoder ' , 'geocoder.adapter ' , 'geocoder.chain ' ] ;
92
88
}
93
89
}
0 commit comments