I have a POST route in Laravel:
Route::post('/quote-summary', 'QuoteController@quoteSummary')->name('quote-summary');
On the view for this route I have a form that submits to another route:
Route::post('/proceed-to-payment', 'QuoteController@proceedToPayment')->name('proceed-to-payment');
Here is my controller method for proceed-to-payment
:
public function proceedToPayment(Request $request) {
if(empty($request->get('tick_statement_of_fact'))) {
return redirect()->route('quote-summary')->with('tick_statement_of_fact', 'I am so frustrated.');
} else {
return view('quote.payment', compact('date_cover_required', 'expiry_date'));
}
}
I am trying to redirect back to quote-summary
but as it was a POST
I am getting a MethodNotAllowedHttpException
as the redirect seems to be doing a GET
.
Any ideas on how I can return to my POST route with some validation error messages?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire