Monday, April 3, 2017

laravel routing form posts to get route

Ok, this is baffling me:

I have a form which has it method set to post, this form has worked fine prior to me altering laravel's routing. Now when I submit the form, laravel detects this it as a get request. I can't see anything that effects the flow, but when I load the page as a get all the form variables are lost.

Routes (where the search is posting to the results:

Route::get('/search/{engine}',[
        "as" => "site.search",
        "uses" => 'SearchController@index'
]);



Route::post('/results/{$engine}',[
        "as" => "site.results",
        "uses" => 'SearchController@results'
]);

Ha any got any idea what could be happening to cause a redirect after the form has submitted?



via frank astin

Advertisement