Browse Source
Merge branch 'mahdi' of https://gitea.hooradev.ir/mahdihty/liwo into mohammad
mohammad
Merge branch 'mahdi' of https://gitea.hooradev.ir/mahdihty/liwo into mohammad
mohammad
Mohammad Akbari
4 years ago
15 changed files with 287 additions and 20 deletions
-
115app/Channels/Messages/SmsMessage.php
-
74app/Channels/SmsChannel.php
-
12app/Enums/sms.php
-
8app/Listeners/NotifHandler.php
-
4app/Models/Business.php
-
10app/Models/User.php
-
2app/Notifications/DBNotification.php
-
17app/Notifications/SmsNotification.php
-
4app/Notifications/SocketNotification.php
-
13app/Providers/AppServiceProvider.php
-
15app/Utilities/HelperClass/NotificationHelper.php
-
16config/smsirlaravel.php
-
1database/migrations/2021_03_08_114700_create_notifications_table.php
-
12resources/lang/fa/notification.php
-
4routes/api.php
@ -0,0 +1,115 @@ |
|||||
|
<?php |
||||
|
|
||||
|
|
||||
|
namespace App\Channels\Messages; |
||||
|
|
||||
|
|
||||
|
class SmsMessage |
||||
|
{ |
||||
|
|
||||
|
/** |
||||
|
* The devices token to send the message from. |
||||
|
* |
||||
|
* @var array|string |
||||
|
*/ |
||||
|
public $to; |
||||
|
|
||||
|
/** |
||||
|
* The data of the Sms message. |
||||
|
* |
||||
|
* @var array |
||||
|
*/ |
||||
|
public $data; |
||||
|
|
||||
|
/** |
||||
|
* The params that we define in sms.ir template |
||||
|
* when we use ultraFastSend method |
||||
|
* |
||||
|
* @var array |
||||
|
*/ |
||||
|
public $params; |
||||
|
|
||||
|
/** |
||||
|
* The id of template we define in sms.ir |
||||
|
* when we use ultraFastSend method |
||||
|
* |
||||
|
* @var string |
||||
|
*/ |
||||
|
public $template_id; |
||||
|
|
||||
|
/** |
||||
|
* The generated verification code. |
||||
|
* when we use sendVerification method. |
||||
|
* |
||||
|
* @var string |
||||
|
*/ |
||||
|
public $verification_code; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* Set the devices token to send the message from. |
||||
|
* |
||||
|
* @param array|string $to |
||||
|
* @return $this |
||||
|
*/ |
||||
|
public function to($to) |
||||
|
{ |
||||
|
$this->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|mixed $params |
||||
|
* @return $this |
||||
|
*/ |
||||
|
public function params($params) |
||||
|
{ |
||||
|
foreach ($params 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($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; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
<?php |
||||
|
|
||||
|
return [ |
||||
|
'types' => [ |
||||
|
'verification_code' => [ |
||||
|
'name' => 'VerificationCode' |
||||
|
], |
||||
|
'ultra_fast_send' => [ |
||||
|
'name' => 'ultraFastSend' |
||||
|
] |
||||
|
], |
||||
|
]; |
@ -0,0 +1,16 @@ |
|||||
|
<?php |
||||
|
|
||||
|
return [ |
||||
|
|
||||
|
/* Important Settings */ |
||||
|
|
||||
|
// ======================================================================
|
||||
|
'webservice-url' => 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), |
||||
|
// ======================================================================
|
||||
|
]; |
Write
Preview
Loading…
Cancel
Save
Reference in new issue