File tree Expand file tree Collapse file tree 3 files changed +17
-5
lines changed Expand file tree Collapse file tree 3 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,10 @@ Find the `aliases` key in `app/config/app.php` and register the **Geocoder Facad
64
64
Configuration
65
65
-------------
66
66
67
+ Publish the configuration
68
+
69
+ $ php artisan config:publish toin0u\geocoder-laravel
70
+
67
71
The service provider creates the following services:
68
72
69
73
* `geocoder`: the Geocoder instance.
Original file line number Diff line number Diff line change 12
12
namespace Toin0u \Geocoder ;
13
13
14
14
use Geocoder \Geocoder ;
15
- use Geocoder \Provider \FreeGeoIpProvider ;
16
- use Geocoder \HttpAdapter \CurlHttpAdapter ;
17
15
use Illuminate \Support \ServiceProvider ;
18
16
19
17
/**
@@ -36,7 +34,7 @@ class GeocoderServiceProvider extends ServiceProvider
36
34
* @return void
37
35
*/
38
36
public function boot () {
39
- $ this ->package ('willdurand /geocoder ' );
37
+ $ this ->package ('toin0u /geocoder-laravel ' );
40
38
}
41
39
42
40
/**
@@ -49,11 +47,15 @@ public function register()
49
47
$ app = $ this ->app ;
50
48
51
49
$ this ->app ['geocoder.adapter ' ] = $ this ->app ->share (function () {
52
- return new CurlHttpAdapter ;
50
+ $ adapter = \Config::get ('geocoder-laravel::adapter ' );
51
+ $ class = 'Geocoder\HttpAdapter \\' . $ adapter ;
52
+ return new $ class ;
53
53
});
54
54
55
55
$ this ->app ['geocoder.provider ' ] = $ this ->app ->share (function ($ app ) {
56
- return new FreeGeoIpProvider ($ app ['geocoder.adapter ' ]);
56
+ $ provider = \Config::get ('geocoder-laravel::provider ' );
57
+ $ class = '\Geocoder\Provider \\' . $ provider ;
58
+ return new $ class ($ app ['geocoder.adapter ' ]);
57
59
});
58
60
59
61
$ this ->app ['geocoder ' ] = $ this ->app ->share (function ($ app ) {
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ return array (
4
+ 'provider ' => 'FreeGeoIpProvider ' ,
5
+ 'adapter ' => 'CurlHttpAdapter '
6
+ );
You can’t perform that action at this time.
0 commit comments