55
66class 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