Api check phone number already request tac

This commit is contained in:
Amir Hassan
2023-07-02 09:52:45 +08:00
parent fb3f5283ec
commit fa240969c9
+13 -1
View File
@@ -152,11 +152,23 @@ class UserController extends Controller
$date = $current->toDateTimeString();
$current_date = strtotime($date);
$future_date = $current_date + (60 * 5);
$future_date = $current_date + (60 * 2);
$expired_date_formated = date("Y-m-d H:i:s", $future_date);
$tac_code = rand(100000, 999999);
$check_status_phone_number = TacCode::where('phone_number', $request->phone_number)
->where('status', 0)
->where('expired_at', '>', $date)
->first();
if ($check_status_phone_number) {
return response()->json([
'success' => false,
'message' => 'The phone number already request for tac code. Please wait 2 minute from request time for the session to end.',
'response' => $check_status_phone_number
]);
}
Http::get('http://gateway.onewaysms.com.my:10001/api.aspx', [
'apiusername' => config('app.one_way_sms_username'),
'apipassword' => config('app.one_way_sms_password'),