fixing freedcamp bugs and created api

This commit is contained in:
Ritikesh yadav
2024-05-06 14:49:49 +05:30
parent bf6fbd7ccd
commit 554c8ceee7
4 changed files with 44 additions and 8 deletions

View File

@@ -293,6 +293,40 @@ class ProfileController extends Controller
}
}
public function resendOtpForProfileUpdate(Request $request)
{
try{
$type = $request->type;
$user_id = request()->user()->id;
$credential = $request->credential;
$otp = rand(1000,9999);
// $getUser = User::find($user_id);
if($type == 1)
{
// type 1 for email otp
// $email = $getUser->email;
$mailData = [
'title' => 'Mail from Jerichoalternatives.in',
'body' => 'This is for testing email using smtp.'
];
Mail::to($credential)->send(new OtpMail($mailData, $otp));
UserOtpModel::where('user_id', $user_id)->update(['email_otp'=> $otp, 'expire_at'=>Carbon::now()->addMinutes(2)]);
}
else if($type == 2)
{
// $mobileNumber = $getUser->contact_number;
$this->thirdPartyOTP($credential, $otp);
UserOtpModel::where('user_id', $user_id)->update(['contact_otp'=> $otp,'expire_at'=>Carbon::now()->addMinutes(2)]);
}
return response()->json([
'status'=>200,
'message'=>'OTP has been send',
]);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function getUser()
{
try {