otp working

This commit is contained in:
Mekan1206
2026-05-19 18:16:54 +05:00
parent 3d64c13b07
commit 68ff1c4c39
3 changed files with 65 additions and 4 deletions

View File

@@ -23,13 +23,13 @@ class VerificationController extends Controller
'phone.regex' => 'The phone number must be in the format: +993 KX XX XX XX (where K is 6 or 7).'
]);
$phone = $request->phone;
$phone = unmask_phone($request->phone);
// Generate a 4-digit OTP
$otp = (string) rand(1000, 9999);
// Log it to simulate SMS
Log::info("OTP for {$phone} is {$otp}");
Log::info('Tassyklaýyş belgi: ' . $otp);
// Store in DB
PhoneVerification::updateOrCreate(
@@ -41,6 +41,8 @@ class VerificationController extends Controller
]
);
sendSMS($phone, $otp);
// Store phone in session for the next step
session()->put('verify_phone', $phone);
@@ -49,7 +51,7 @@ class VerificationController extends Controller
public function verifyForm()
{
if (!session()->has('verify_phone')) {
if (! session()->has('verify_phone')) {
return redirect()->route('verification.index');
}