您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

56 行
1.4KB

  1. <?php
  2. namespace App\Providers;
  3. use App\Codes\EnvironmentName;
  4. use App\Codes\QueueName;
  5. use Illuminate\Queue\Events\JobProcessing;
  6. use Illuminate\Support\Facades\Log;
  7. use Illuminate\Support\Facades\Queue;
  8. use Illuminate\Support\ServiceProvider;
  9. use Illuminate\Support\Str;
  10. class AppServiceProvider extends ServiceProvider
  11. {
  12. /**
  13. * Register any application services.
  14. */
  15. public function register(): void
  16. {
  17. //
  18. }
  19. /**
  20. * Bootstrap any application services.
  21. */
  22. public function boot(): void
  23. {
  24. if ($this->app->environment(EnvironmentName::LOCAL->value)) {
  25. // IDEヘルパー登録
  26. $this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
  27. }
  28. //Queue関連
  29. Queue::before(function (JobProcessing $event) {
  30. // Logのドライバー設定
  31. $queueName = $event->job->getQueue();
  32. if ($queueName === QueueName::EMAIL->value) {
  33. Log::setDefaultDriver('queue-email');
  34. } else if ($queueName === QueueName::JOB->value) {
  35. Log::setDefaultDriver('queue-job');
  36. }
  37. Log::withContext([
  38. '__job_uuid__' => strval(Str::uuid()),
  39. ]);
  40. });
  41. // DB関連
  42. $this->app->singleton(\App\Util\DBUtil::class);
  43. // KINTONE関連
  44. $this->app->singleton(\App\Kintone\KintoneAccessStore::class);
  45. }
  46. }