EventServiceProvider.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace App\Providers;
  3. use App\Events\PayTotalEvent;
  4. use App\Listeners\PayTotalIncListener;
  5. use Illuminate\Auth\Events\Registered;
  6. use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
  7. use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
  8. use Illuminate\Support\Facades\Event;
  9. class EventServiceProvider extends ServiceProvider
  10. {
  11. /**
  12. * The event to listener mappings for the application.
  13. *
  14. * @var array<class-string, array<int, class-string>>
  15. */
  16. protected $listen = [
  17. Registered::class => [
  18. SendEmailVerificationNotification::class,
  19. ],
  20. // 支付统计事件监听
  21. PayTotalEvent::class => [
  22. PayTotalIncListener::class
  23. ],
  24. ];
  25. /**
  26. * Register any events for your application.
  27. *
  28. * @return void
  29. */
  30. public function boot()
  31. {
  32. //
  33. }
  34. /**
  35. * Determine if events and listeners should be automatically discovered.
  36. *
  37. * @return bool
  38. */
  39. public function shouldDiscoverEvents()
  40. {
  41. return false;
  42. }
  43. }