1return Redirect::back()->withErrors(['msg', 'The Message']);
2
3and inside your view call this
4
5@if($errors->any())
6<h4>{{$errors->first()}}</h4>
7@endif
1// Laravel 5
2return redirect()->back()->withInput();
3// Laravel 6,7, 8
4return back()->withInput();
11. The cleanest way seems to be using the url() helper:
2 {{ url()->previous() }}
3
42. URL::previous() works for me in my Laravel 5.1 project. Here is Laravel 5.1
5 doc for previous() method, which is accessible through URL Facade.
6
73. You can still try alternatives, in your views you can do:
8
9 {{ redirect()->getUrlGenerator()->previous() }}
10 OR
11 {{ redirect()->back()->getTargetUrl() }}
1Route::post('user/profile', function () {
2 // Update the user's profile...
3
4 return redirect('dashboard')->with('status', 'Profile updated!');
5});