Answered by : mohamad-shahkhajeh
Route::redirect('/here', '/there');
or
return redirect(route('register'));
Source : https://laravel.com/docs/8.x/routing | Last Update : Sat, 24 Jul 21
Answered by : lokesh-ramchandani-in6l3jq294i2
1. The cleanest way seems to be using the url() helper: {{ url()->previous() }}
2. URL::previous() works for me in my Laravel 5.1 project. Here is Laravel 5.1 doc for previous() method, which is accessible through URL Facade.
3. You can still try alternatives, in your views you can do: {{ redirect()->getUrlGenerator()->previous() }} OR {{ redirect()->back()->getTargetUrl() }}
Source : | Last Update : Sun, 09 Aug 20
Answered by : abdullah-al-mamun
return redirect()->route('login');
Source : https://laravel.com/docs/8.x/redirects#redirecting-named-routes | Last Update : Sat, 06 Feb 21
Answered by : indian-gooner
Route::post('/user/profile', function () { // Update the user's profile... return redirect('/dashboard')->with('status', 'Profile updated!');
});
Source : https://laravel.com/docs/8.x/redirects#redirecting-named-routes | Last Update : Thu, 17 Dec 20
Answered by : lucky-loris-wzjb2jpfcpsx
// For a route with the following URI: profile/{id}
return redirect()->route('profile', [$user]);
Source : https://laravel.com/docs/7.x/redirects | Last Update : Sat, 06 Jun 20
Answered by : important-iguana-rt3alpk4ki6p
@if(Auth::user()->role_id == 1) {{ 'Page' }}
@else <script>window.location = "/dashboard";</script>
@endif
Source : https://stackoverflow.com/questions/43118075/laravel-redirect-issue-from-blade-template | Last Update : Fri, 03 Dec 21
Answered by : farhan-bajwa
return redirect('/home/dashboard');
Source : | Last Update : Tue, 05 Jul 22
Answered by : lucky-loris-wzjb2jpfcpsx
// For a route with the following URI: profile/{id}
return redirect()->route('profile', ['id' => 1]);
Source : https://laravel.com/docs/7.x/redirects | Last Update : Sat, 06 Jun 20
Answered by : abdullah-al-mamun
return redirect()->away('extranal video link');
Source : | Last Update : Thu, 17 Mar 22