Redirect url to previous page in laravel

You should use return redirect()->back();


Inside your template file you can just use:

{{ url()->previous() }}

You have a global back function:

return back();

Thank You for answers. I've got it now.

set the hidden variable in blade to get previous page url using

{{  Form::hidden('url',URL::previous())  }}

after that get it by $request->input('url'); in controller,Then redirect it.

return redirect($url)->with('success', 'Data saved successfully!');