I have a controller called "AgendaComplejoController". In this controller I have my index view. Ito my index.blade.php I have a form with a button(I made a form just to make a post request):
<form role="form" method="POST" action="{{ url('/guardarTurno') }}">
{{ csrf_field() }}
<button type="submit" class="btn btn-labeled btn-success button-infousuario">
<span class="btn-label"><i class="fa fa-check fa-fw"></i></span>
Confirmar turno
</button>
</form>
I want to call a function into my Agendacontroller
public function guardarTurno(Request $request)
{
Log::info('entré al guardar turnos');
Log::info('json: '.json_encode($request));
}
My route is:
Route::get('/guardarTurno', 'AgendaComplejoController@guardarTurno');
I have the following error:
MethodNotAllowedHttpException
But I can't connect my blade view with my controller method.
What I'm doing wrong?
POST
to aget
route. Change your route from get to post. – aynber