From 969a373e066ef51172f0bc3722780cd1358b56fd Mon Sep 17 00:00:00 2001 From: Hasan Al-Yazidi Date: Sun, 26 Jun 2022 05:56:21 +0200 Subject: [PATCH] SMS: Add enable/disable sending SMS option --- config/sendables.php | 4 ++++ src/OTP/OtpVerifier.php | 2 -- src/SMS/SMSNotification.php | 6 ++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/config/sendables.php b/config/sendables.php index aeb6443..dd703c4 100644 --- a/config/sendables.php +++ b/config/sendables.php @@ -11,6 +11,10 @@ * SMS configuration */ 'sms' => [ + 'options' => [ + 'enabled' => true, + ], + 'providers' => [ /** * Default SMS Provider diff --git a/src/OTP/OtpVerifier.php b/src/OTP/OtpVerifier.php index 5be27d1..372a24d 100644 --- a/src/OTP/OtpVerifier.php +++ b/src/OTP/OtpVerifier.php @@ -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(); - } } diff --git a/src/SMS/SMSNotification.php b/src/SMS/SMSNotification.php index eadec1a..862ae6c 100644 --- a/src/SMS/SMSNotification.php +++ b/src/SMS/SMSNotification.php @@ -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(); }