FollowPushNotifyPipeline.php 766 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace App\Jobs\PushNotificationPipeline;
  3. use App\Services\NotificationAppGatewayService;
  4. use Exception;
  5. use Illuminate\Contracts\Queue\ShouldQueue;
  6. use Illuminate\Foundation\Queue\Queueable;
  7. class FollowPushNotifyPipeline implements ShouldQueue
  8. {
  9. use Queueable;
  10. public $pushToken;
  11. public $actor;
  12. /**
  13. * Create a new job instance.
  14. */
  15. public function __construct($pushToken, $actor)
  16. {
  17. $this->pushToken = $pushToken;
  18. $this->actor = $actor;
  19. }
  20. /**
  21. * Execute the job.
  22. */
  23. public function handle(): void
  24. {
  25. try {
  26. NotificationAppGatewayService::send($this->pushToken, 'follow', $this->actor);
  27. } catch (Exception $e) {
  28. return;
  29. }
  30. }
  31. }