I do a post request to a route calculate-cars and display an other view with some data I query based on the data I entered in the form I do the post request from, but I want to redirect to the homepage when someone access this route directly.
Unfortunately I keep getting this error:
Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException No message
my route:
Route::post('calculate-cars', 'CarsController@calculateCars');
I know I get this error because I access a post route directly but I try this in my controller method but I still get the same error:
if (!$request->isMethod('post')) {
return redirect()->to('/');
}
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2AF4Xpp
via IFTTT
Aucun commentaire:
Enregistrer un commentaire