Please list your routes and the controller method with the redirect statement.
laravel redirect back to post route, i get MethodNotAllowedHttpException
At first on a get request i show a form, on submitting it, it goes to a post url does some working in the controller and then returns another view which has a form. after submitting this form i validate some things and if the validation fails i want to redirect back with some errors but unfortunately laravel isn't allowing me to redirect back to a post method. Is there any way i can accomplish this?
i have seen this answer on laracast https://laracasts.com/discuss/channels/laravel/redirect-back-to-post-route-i-get-methodnotallowed-exception but i couldn't grasp the recommendation
these are my routes in the order described above.
Route::get('/purchasePacks', 'masterDealerController@purchasePacks')->name('purchasePacks');
Route::post('/confirmPuchasedPacks','masterDealerController@confirmPuchasedPacks');
Route::post('/storeOrder','masterDealerController@storeOrder');
below is the redirection code in the storeOrder method. which redirects back to the post url
Alert::message("Unable to complete your payment at the moment.",'Please try again later.',"error");
return back()->withInput();
simple rule to make your life easier... NEVER return a view in response to a POST request. Always redirect somewhere else which shows the result of the post or displays the next form.
Please or to participate in this conversation.