@@ -19,10 +19,14 @@ class GeoIPServiceProvider extends ServiceProvider
1919 */
2020 public function boot ()
2121 {
22- $ this ->app ['PulkitJalan\GeoIP\GeoIP ' ] = function ($ app ) {
23- return $ app ['geoip ' ];
22+ $ this ->app ['geoip ' ] = function ($ app ) {
23+ return $ app ['PulkitJalan\GeoIP\GeoIP ' ];
2424 };
2525
26+ if ($ this ->app ->runningInConsole ()) {
27+ $ this ->commands (['PulkitJalan\GeoIP\Console\UpdateCommand ' ]);
28+ }
29+
2630 if (function_exists ('config_path ' )) {
2731 $ this ->publishes ([
2832 __DIR__ .'/config/config.php ' => config_path ('geoip.php ' ),
@@ -32,8 +36,6 @@ public function boot()
3236
3337 /**
3438 * Register the service provider.
35- *
36- * @return void
3739 */
3840 public function register ()
3941 {
@@ -46,28 +48,22 @@ public function register()
4648
4749 /**
4850 * Register the main geoip wrapper.
49- *
50- * @return void
5151 */
5252 protected function registerGeoIP ()
5353 {
54- $ this ->app ->singleton ('geoip ' , function ( ) {
55- return new GeoIP (config ( ' geoip ') );
54+ $ this ->app ->singleton ('PulkitJalan\GeoIP\GeoIP ' , function ( $ app ) {
55+ return new GeoIP ($ app [ ' config ' ][ ' geoip '] );
5656 });
5757 }
5858
5959 /**
6060 * Register the geoip update console command.
61- *
62- * @return void
6361 */
6462 protected function registerUpdateCommand ()
6563 {
66- $ this ->app ->singleton ('geoip ' , function ( ) {
67- return new UpdateCommand (config ( ' geoip ') );
64+ $ this ->app ->singleton ('PulkitJalan\GeoIP\Console\UpdateCommand ' , function ( $ app ) {
65+ return new UpdateCommand ($ app [ ' config ' ][ ' geoip '] );
6866 });
69-
70- $ this ->commands (['command.geoip.update ' ]);
7167 }
7268
7369 /**
@@ -77,6 +73,10 @@ protected function registerUpdateCommand()
7773 */
7874 public function provides ()
7975 {
80- return ['geoip ' , 'command.geoip.update ' , 'PulkitJalan\GeoIP\GeoIP ' ];
76+ return [
77+ 'PulkitJalan\GeoIP\GeoIP ' ,
78+ 'PulkitJalan\GeoIP\Console\UpdateCommand ' ,
79+ 'geoip ' ,
80+ ];
8181 }
8282}
0 commit comments