Update user registration email format, remove unused SMS helper function, and adjust database migration for user meta column
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\OTPVerification\Repositories;
|
||||
|
||||
use App\Modules\OTPVerification\Models\OTPVerification;
|
||||
use App\Modules\SMS\Repositories\SMSRepository;
|
||||
|
||||
class OTPVerificationRepository
|
||||
{
|
||||
/**
|
||||
* Send a sms verification
|
||||
*/
|
||||
public static function sendSMSVerification(string|int $phone_number): ?OTPVerification
|
||||
{
|
||||
/* for apple testing */
|
||||
$phone_code = ($phone_number == '61126667') ? 77777 : rand(10000, 99999);
|
||||
|
||||
$verification = OTPVerification::where(['username' => $phone_number])->first();
|
||||
$verification
|
||||
? $verification->update(['code' => $phone_code])
|
||||
: OTPVerification::create(['username' => $phone_number, 'code' => $phone_code]);
|
||||
|
||||
SMSRepository::sendSMS($phone_number, 'Tassyklaýyş belgi: '.$phone_code);
|
||||
|
||||
return $verification;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user