ManualPush.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace App\Notifications\Push\Manual;
  3. use App\Enums\PushNotificationCategoryEnum;
  4. use App\Enums\PushNotificationTargetEnum;
  5. use App\Notifications\Push\BasePushNotification;
  6. use Illuminate\Database\Eloquent\Collection;
  7. /**
  8. * Push disparada manualmente pelo backoffice: título e corpo vêm do formulário,
  9. * não do código. NÃO é registrada no PushNotificationDispatcher::all() — o envio
  10. * é sempre por chamada direta, a partir do SendManualPushJob.
  11. */
  12. class ManualPush extends BasePushNotification
  13. {
  14. public function __construct(
  15. private string $title,
  16. private string $body,
  17. private PushNotificationTargetEnum $target,
  18. ) {}
  19. public function label(): string
  20. {
  21. return 'manual_push';
  22. }
  23. public function title(): string
  24. {
  25. return $this->title;
  26. }
  27. public function body(): string
  28. {
  29. return $this->body;
  30. }
  31. public function target(): PushNotificationTargetEnum
  32. {
  33. return $this->target;
  34. }
  35. public function category(): PushNotificationCategoryEnum
  36. {
  37. return PushNotificationCategoryEnum::MANUAL;
  38. }
  39. public function notificationCooldownDays(): int
  40. {
  41. return 0;
  42. }
  43. public function categoryCooldownDays(): int
  44. {
  45. return 0;
  46. }
  47. public function eligibleUsers(): Collection
  48. {
  49. return new Collection();
  50. }
  51. }