In this tutorial, I will tell you the new features
Route::redirect() helpers added with Laravel 5.5.
Sometime you need to return only a view then you define a route and then return view using
view() helpers function.
With the release of Laravel 5.5, You can use the
Route::view method that provides a easier shortcut load view for a URI.
Before Laravel 5.5
Route::view method accepts a URI as a first argument and in second argument you will pass the view name.
Before Laravel 5.5, If you need to return view only for specific URI then you were using the following syntax :
- return view('dashboard');
Laravel 5.5 provides the shortcut for achieving the above functionality in single line:
Route::redirect method provides the shortcut to redirect from one URI to another URI.Before Laravel 5.5
Sometime you want to redirect to a specific URI by accessing another URI then you defined the route with particular URI and then redirect to specific URI using the
redirect method in following way :
- return redirect('/dashboard');
In the above example, If a user hits the root url then he will be redirected to the dashboard.With Laravel 5.5
You can achieve the same functionality by using
Route::redirect() method in following way :