Skip to content

Commit 5c0d5a8

Browse files
committed
Add support for Laravel 5.4
1 parent 68a9b67 commit 5c0d5a8

File tree

2 files changed

+50
-52
lines changed

2 files changed

+50
-52
lines changed

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
],
1212
"require": {
1313
"php": ">=5.3.0",
14-
"illuminate/support": "~5.0",
15-
"illuminate/session": "~5.0",
16-
"illuminate/console": "~5.0",
17-
"illuminate/config": "~5.0",
14+
"illuminate/support": "5.0 - 5.4",
15+
"illuminate/session": "5.0 - 5.4",
16+
"illuminate/console": "5.0 - 5.4",
17+
"illuminate/config": "5.0 - 5.4",
1818
"monolog/monolog": "~1.11",
1919
"geoip2/geoip2": "~2.1"
2020
},

src/Torann/GeoIP/GeoIPServiceProvider.php

Lines changed: 46 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -5,53 +5,51 @@
55

66
class GeoIPServiceProvider extends ServiceProvider {
77

8-
/**
9-
* Indicates if loading of the provider is deferred.
10-
*
11-
* @var bool
12-
*/
13-
protected $defer = false;
14-
15-
/**
16-
* Bootstrap the application events.
17-
*
18-
* @return void
19-
*/
20-
public function boot()
21-
{
22-
$this->publishes([
23-
__DIR__.'/../../config/geoip.php' => config_path('geoip.php'),
24-
]);
25-
}
26-
27-
/**
28-
* Register the service provider.
29-
*
30-
* @return void
31-
*/
32-
public function register()
33-
{
34-
// Register providers.
35-
$this->app['geoip'] = $this->app->share(function($app)
36-
{
37-
return new GeoIP($app['config'], $app["session.store"]);
38-
});
39-
40-
$this->app['command.geoip.update'] = $this->app->share(function ($app)
41-
{
42-
return new UpdateCommand($app['config']);
43-
});
44-
$this->commands(['command.geoip.update']);
45-
}
46-
47-
/**
48-
* Get the services provided by the provider.
49-
*
50-
* @return array
51-
*/
52-
public function provides()
53-
{
54-
return array('geoip', 'command.geoip.update');
55-
}
8+
/**
9+
* Indicates if loading of the provider is deferred.
10+
*
11+
* @var bool
12+
*/
13+
protected $defer = false;
14+
15+
/**
16+
* Bootstrap the application events.
17+
*
18+
* @return void
19+
*/
20+
public function boot()
21+
{
22+
$this->publishes([
23+
__DIR__.'/../../config/geoip.php' => config_path('geoip.php'),
24+
]);
25+
}
26+
27+
/**
28+
* Register the service provider.
29+
*
30+
* @return void
31+
*/
32+
public function register()
33+
{
34+
$this->app->singleton('geoip', function ($app) {
35+
return new GeoIP($app['config'], $app['session.store']);
36+
});
37+
38+
$this->app->singleton('command.geoip.update', function ($app) {
39+
return new UpdateCommand($app['config']);
40+
});
41+
42+
$this->commands(['command.geoip.update']);
43+
}
44+
45+
/**
46+
* Get the services provided by the provider.
47+
*
48+
* @return array
49+
*/
50+
public function provides()
51+
{
52+
return array('geoip', 'command.geoip.update');
53+
}
5654

5755
}

0 commit comments

Comments
 (0)