Add SMS sending and verification methods to SMSModule; integrate OTPVerification check
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Modules\SMS;
|
|||||||
|
|
||||||
use App\Modules\Makeable;
|
use App\Modules\Makeable;
|
||||||
use App\Modules\ModuleContract;
|
use App\Modules\ModuleContract;
|
||||||
|
use App\Modules\SMS\Repositories\SMSRepository;
|
||||||
|
|
||||||
class SMSModule implements ModuleContract
|
class SMSModule implements ModuleContract
|
||||||
{
|
{
|
||||||
@@ -45,4 +46,30 @@ class SMSModule implements ModuleContract
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a sms
|
||||||
|
*/
|
||||||
|
public function send(...$args)
|
||||||
|
{
|
||||||
|
return SMSRepository::sendSMS(...$args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a sms verification
|
||||||
|
*/
|
||||||
|
public function verify(...$args)
|
||||||
|
{
|
||||||
|
if (class_exists('App\Modules\OTPVerification\Repositories\OTPVerificationRepository') && module('OTPVerification')->isEnabled()) {
|
||||||
|
$OTPVerificationRepository = 'App\Modules\OTPVerification\Repositories\OTPVerificationRepository';
|
||||||
|
|
||||||
|
return $OTPVerificationRepository::sendSMSVerification(...$args);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (app()->environment('local')) {
|
||||||
|
throw new \Exception('OTPVerification module is not enabled');
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user