AppServiceProvider.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace App\Providers;
  3. use App\Models\BlockItems;
  4. use App\Models\ContractDistribution;
  5. use App\Observers\BlockItemObserver;
  6. use App\Observers\ContractDistributionObserver;
  7. use App\Observers\CouponGrantRangeObserver;
  8. use App\Observers\CouponRangeObserver;
  9. use App\Observers\GoodsSpecObserver;
  10. use Illuminate\Contracts\Routing\UrlGenerator;
  11. use Illuminate\Support\ServiceProvider;
  12. class AppServiceProvider extends ServiceProvider
  13. {
  14. /**
  15. * Register any application services.
  16. *
  17. * @return void
  18. */
  19. public function register()
  20. {
  21. //
  22. }
  23. /**
  24. * Bootstrap any application services.
  25. *
  26. * @return void
  27. */
  28. public function boot(UrlGenerator $url)
  29. {
  30. // 设置全局https
  31. if( strtolower(env('APP_ENV')) !== 'local' ){
  32. $url->forceScheme('https');
  33. }
  34. //商品规格库存更新触发事件
  35. BlockItems::observe(BlockItemObserver::class);
  36. ContractDistribution::observe(ContractDistributionObserver::class);
  37. }
  38. }