You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
831 B

  1. <?php
  2. namespace App\Channels\Messages;
  3. class SocketMessage
  4. {
  5. /**
  6. * The devices token to send the message from.
  7. *
  8. * @var array|string
  9. */
  10. public $to;
  11. /**
  12. * The data of the Socket message.
  13. *
  14. * @var array
  15. */
  16. public $data;
  17. /**
  18. * Set the devices token to send the message from.
  19. *
  20. * @param array|string $to
  21. * @return $this
  22. */
  23. public function to($to)
  24. {
  25. if (is_array($to) && count($to) === 1) {
  26. $this->to = $to[0];
  27. } else {
  28. $this->to = $to;
  29. }
  30. return $this;
  31. }
  32. /**
  33. * Set the data of the FCM message.
  34. *
  35. * @param array $data
  36. * @return $this
  37. */
  38. public function data(array $data)
  39. {
  40. $this->data = $data;
  41. return $this;
  42. }
  43. }