Skip to content

Commit

Permalink
[wip] add sms messages status to config
Browse files Browse the repository at this point in the history
  • Loading branch information
aryala7 committed Nov 25, 2023
1 parent 797e49b commit e67d4cc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions config/chapaar.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
// Set the default driver for the Chapaar package
'default' => env('CHAPAAR_DRIVER', 'kavenegar'),

// Whether Store sent datas to database

'store_sms_messages' => env('CHAPAAR_STORE_SMS_MESSAGES',false),

// Define configurations for different drivers
'drivers' => [
// Configuration for the 'kavenegar' driver
Expand Down
4 changes: 2 additions & 2 deletions src/Chapaar.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function getDefaultDriver(): DriverConnector
public function send($message): object
{
$response = $this->driver($message->getDriver())->send($message);
if(count($response)) {
if(config('chapaar.store_sms_messages') && count($response)) {
SmsSent::dispatch($message->driver,$message,$response['status']);
}
return $response;
Expand All @@ -36,7 +36,7 @@ public function send($message): object
public function verify(DriverMessage $message): object
{
$response = $this->driver($message->getDriver())->verify($message);
if(count($response)) {
if(config('chapaar.store_sms_messages') && count($response)) {
SmsSent::dispatch($message->getDriver(),$message,$response['status']);
}
return $response;
Expand Down

0 comments on commit e67d4cc

Please sign in to comment.