ServiceProvider.php 457 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace Chuckpac\Weather;
  3. class ServiceProvider extends \Illuminate\Support\ServiceProvider
  4. {
  5. protected $defer = true;
  6. public function register()
  7. {
  8. $this->app->singleton(Weather::class, function(){
  9. return new Weather(config('services.weather.key'));
  10. });
  11. $this->app->alias(Weather::class, 'weather');
  12. }
  13. public function provides()
  14. {
  15. return [Weather::class, 'weather'];
  16. }
  17. }