I'm working with Laravel 8 to develop my project and I have built this form for verifying token:
<div class="card-body">
<form action="{{ route('profile.2fa.phone') }}" method="POST">
@csrf
<div class="form-group">
<label for="token" class="col-form-label">Token</label>
<input type="text" class="form-control @error('token') is-invalid @enderror" name="token" placeholder="enter your token">
@error('token')
<span class="invalid-feedback">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="form-group">
<button class="btn btn-primary">Validate token</button>
</div>
</form>
</div>
And then at web.php I have these routes:
Route::get('/settings/twofactor/phone' , [App\Http\Controllers\Admin\AdminSettingsController::class, 'getPhoneVerify']);
Route::post('/settings/twofactor/phone' , [App\Http\Controllers\Admin\AdminSettingsController::class, 'postPhoneVerify'])->name('profile.2fa.phone');
But now when I add the token and press the Validate Token button, I get this error:
Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException The GET method is not supported for this route. Supported methods: POST.
So what is going wrong here? How can I solve this issue?
I would really appreciate any idea or suggestion from you guys...
Thanks in advance.