Update user registration email format, remove unused SMS helper function, and adjust database migration for user meta column

This commit is contained in:
2025-09-22 16:50:01 +05:00
parent f14defeebd
commit baf23d4124
12 changed files with 264 additions and 30 deletions

View File

@@ -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;
}
}