Skip to content

Commit

Permalink
SMS: Add enable/disable sending SMS option
Browse files Browse the repository at this point in the history
  • Loading branch information
HasanAlyazidi committed Jun 26, 2022
1 parent dffb7cd commit 969a373
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions config/sendables.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
* SMS configuration
*/
'sms' => [
'options' => [
'enabled' => true,
],

'providers' => [
/**
* Default SMS Provider
Expand Down
2 changes: 0 additions & 2 deletions src/OTP/OtpVerifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ public function confirm(string $code) : void
$this->isConfirmed = $this->getProvider()->confirm($code);
} catch (\Throwable $th) {
$this->isConfirmed = false;
echo $th->getMessage();

}
}

Expand Down
6 changes: 6 additions & 0 deletions src/SMS/SMSNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ public function __construct(string $message, $mobileNumbers) {

public function send()
{
$isSmsEnabled = config('sendables.sms.options.enabled', true);

if (!$isSmsEnabled) {
return;
}

$this->provider->send();
}

Expand Down

0 comments on commit 969a373

Please sign in to comment.