AppServiceProvider.php 843 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /*
  3. * This file is part of the Jiannei/lumen-api-starter.
  4. *
  5. * (c) Jiannei <longjian.huang@foxmail.com>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. namespace App\Providers;
  11. use Carbon\Carbon;
  12. use Illuminate\Support\Facades\App;
  13. use Illuminate\Support\ServiceProvider;
  14. class AppServiceProvider extends ServiceProvider
  15. {
  16. /**
  17. * Register any application services.
  18. */
  19. public function register()
  20. {
  21. }
  22. /**
  23. * Bootstrap any application services.
  24. *
  25. * @return void
  26. */
  27. public function boot()
  28. {
  29. if (App::getLocale() == 'zh_CN') {
  30. Carbon::setLocale('zh');
  31. }
  32. $this->registerObservers(); // 注册观察者
  33. }
  34. protected function registerObservers(): void
  35. {
  36. }
  37. }