From d75eff7061883f56261e51ae6773bcabfb97ca16 Mon Sep 17 00:00:00 2001 From: mahdihty Date: Tue, 16 Mar 2021 14:09:44 +0330 Subject: [PATCH] add sms message and config --- app/Channels/Messages/SmsMessage.php | 115 +++++++++++++++++++++++++++ config/smsirlaravel.php | 16 ++++ 2 files changed, 131 insertions(+) create mode 100644 app/Channels/Messages/SmsMessage.php create mode 100644 config/smsirlaravel.php diff --git a/app/Channels/Messages/SmsMessage.php b/app/Channels/Messages/SmsMessage.php new file mode 100644 index 0000000..0d8991f --- /dev/null +++ b/app/Channels/Messages/SmsMessage.php @@ -0,0 +1,115 @@ +to = $to; + + return $this; + } + + /** + * Set the data of the sms message. + * + * @param array $data + * @return $this + */ + public function data(array $data) + { + $this->data = $data; + + return $this; + } + + /** + * Set the params of the sms message when we use ultraFastSend method + * + * @param array $params + * @return $this + */ + public function params(array $params) + { + foreach ($parameters as $key => $value) { + $this->params[] = ['Parameter' => $key, 'ParameterValue' => $value]; + } + return $this; + } + + /** + * Set the template_id of the sms message when we use ultraFastSend method + * + * @param string $template_id + * @return $this + */ + public function templateId(string $template_id) + { + $this->template_id = $template_id; + + return $this; + } + + /** + * Set verification_code of sms message when we use sendVerification method + * + * @param string $verification_code + * @return $this + */ + public function verificationCode(string $verification_code) + { + $this->verification_code = $verification_code; + + return $this; + } + +} diff --git a/config/smsirlaravel.php b/config/smsirlaravel.php new file mode 100644 index 0000000..3ef586a --- /dev/null +++ b/config/smsirlaravel.php @@ -0,0 +1,16 @@ + env('SMSIR_WEBSERVICE_URL','https://ws.sms.ir/'), + // SMS.ir Api Key + 'api-key' => env('SMSIR_API_KEY',null), + // SMS.ir Secret Key + 'secret-key' => env('SMSIR_SECRET_KEY',null), + // Your sms.ir line number + 'line-number' => env('SMSIR_LINE_NUMBER',null), + // ====================================================================== +];