How do I redirect back to my form page, with the given POST
params, if my form action throws an exception?
If you just want to redirect a user back to the previous page (the most common example - is to redirect back to the form page after data validation failed), you can use this: return redirect()->back();
You may use Redirect::intended function. It will redirect the user to the URL they were trying to access before being caught by the authenticaton filter.
Redirect to a specific page in Laravel using ajax - Stack In order to redirect everything on web routes, you can add the following piece of code in your app's route/web. php file Route::any( '{catchall}', function(){ // return redirect( 'https://digitizor.com' ) // OR, Do something here })->where( 'catchall', '.
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 \Illuminate\Foundation\Validation\ValidatesRequests
:
return redirect()->to($this->getRedirectUrl()) ->withInput($request->input()) ->withErrors($errors, $this->errorBag());
write old function on your fields value for example
<input type="text" name="username" value="{{ old('username') }}">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With