Skip to content

Commit f2c7acd

Browse files
committed
Merge pull request #1 from spinegar/master
Make upgrade safe
2 parents dc2245d + 0355c5b commit f2c7acd

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ Find the `aliases` key in `app/config/app.php` and register the **Geocoder Facad
6464
Configuration
6565
-------------
6666

67+
Publish the configuration
68+
69+
$ php artisan config:publish toin0u\geocoder-laravel
70+
6771
The service provider creates the following services:
6872

6973
* `geocoder`: the Geocoder instance.

src/Toin0u/Geocoder/GeocoderServiceProvider.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
namespace Toin0u\Geocoder;
1313

1414
use Geocoder\Geocoder;
15-
use Geocoder\Provider\FreeGeoIpProvider;
16-
use Geocoder\HttpAdapter\CurlHttpAdapter;
1715
use Illuminate\Support\ServiceProvider;
1816

1917
/**
@@ -36,7 +34,7 @@ class GeocoderServiceProvider extends ServiceProvider
3634
* @return void
3735
*/
3836
public function boot() {
39-
$this->package('willdurand/geocoder');
37+
$this->package('toin0u/geocoder-laravel');
4038
}
4139

4240
/**
@@ -49,11 +47,15 @@ public function register()
4947
$app = $this->app;
5048

5149
$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;
5353
});
5454

5555
$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']);
5759
});
5860

5961
$this->app['geocoder'] = $this->app->share(function($app) {

src/config/config.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
return array(
4+
'provider' => 'FreeGeoIpProvider',
5+
'adapter' => 'CurlHttpAdapter'
6+
);

0 commit comments

Comments
 (0)