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.

115 lines
2.1 KiB

  1. <?php
  2. namespace App\Channels\Messages;
  3. class SmsMessage
  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 Sms message.
  13. *
  14. * @var array
  15. */
  16. public $data;
  17. /**
  18. * The params that we define in sms.ir template
  19. * when we use ultraFastSend method
  20. *
  21. * @var array
  22. */
  23. public $params;
  24. /**
  25. * The id of template we define in sms.ir
  26. * when we use ultraFastSend method
  27. *
  28. * @var string
  29. */
  30. public $template_id;
  31. /**
  32. * The generated verification code.
  33. * when we use sendVerification method.
  34. *
  35. * @var string
  36. */
  37. public $verification_code;
  38. /**
  39. * Set the devices token to send the message from.
  40. *
  41. * @param array|string $to
  42. * @return $this
  43. */
  44. public function to($to)
  45. {
  46. $this->to = $to;
  47. return $this;
  48. }
  49. /**
  50. * Set the data of the sms message.
  51. *
  52. * @param array $data
  53. * @return $this
  54. */
  55. public function data(array $data)
  56. {
  57. $this->data = $data;
  58. return $this;
  59. }
  60. /**
  61. * Set the params of the sms message when we use ultraFastSend method
  62. *
  63. * @param array $params
  64. * @return $this
  65. */
  66. public function params(array $params)
  67. {
  68. foreach ($parameters as $key => $value) {
  69. $this->params[] = ['Parameter' => $key, 'ParameterValue' => $value];
  70. }
  71. return $this;
  72. }
  73. /**
  74. * Set the template_id of the sms message when we use ultraFastSend method
  75. *
  76. * @param string $template_id
  77. * @return $this
  78. */
  79. public function templateId(string $template_id)
  80. {
  81. $this->template_id = $template_id;
  82. return $this;
  83. }
  84. /**
  85. * Set verification_code of sms message when we use sendVerification method
  86. *
  87. * @param string $verification_code
  88. * @return $this
  89. */
  90. public function verificationCode(string $verification_code)
  91. {
  92. $this->verification_code = $verification_code;
  93. return $this;
  94. }
  95. }