How do I redirect back to my form page, with the given POST params, if my form action throws an exception?
POST
You can use the following:
return Redirect::back()->withInput(Input::all());
If you're using Form Request Validation, this is exactly how Laravel will redirect you back with errors and the given input.
Excerpt from IlluminateFoundationValidationValidatesRequests:
IlluminateFoundationValidationValidatesRequests
return redirect()->to($this->getRedirectUrl()) ->withInput($request->input()) ->withErrors($errors, $this->errorBag());
1.4m articles
1.4m replys
5 comments
57.0k users