Home > front end >  While hitting anchor tag, getting route not defined error
While hitting anchor tag, getting route not defined error

Time:09-18

Laravel Route:

Route::post('verify-phone', [LoginController::class, 'verifyPhone'])->name('verify-phone');
<a href="{{route('verify-phone')}}" >Resend OTP</a>

CodePudding user response:

It should be like below. Since this route is a href tag so use Route::get()

Route::get('verify-phone', [LoginController::class, 'verifyPhone'])->name('verify-phone')

CodePudding user response:

You should use form if you are using post request then it works fine

<form action="{{route('/verify-phone')}}" method="POST">
<a type="submit"> Resend Otp </a>
<form>
  • Related