EventServiceProvider.php 1.3 KB

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