Add SMS sending and verification methods to SMSModule; integrate OTPVerification check

This commit is contained in:
2025-09-22 17:04:29 +05:00
parent baf23d4124
commit a04c5b1f00

View File

@@ -4,6 +4,7 @@ namespace App\Modules\SMS;
use App\Modules\Makeable;
use App\Modules\ModuleContract;
use App\Modules\SMS\Repositories\SMSRepository;
class SMSModule implements ModuleContract
{
@@ -45,4 +46,30 @@ class SMSModule implements ModuleContract
{
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;
}
}