All for Joomla The Word of Web Design

Laravel 5.5 introduces new Route Methods

custom 404 page laravel

Laravel 5.5  introduced a couple of new shortcut methods in Router class that overlap the uses of controller or closure in the case of return view or redirect to some else page. If you didn’t check this in the release notes, let’s have a look at them. I am sure that they will your code and use of multiple files


First Method Route::redirect Method

The Route::redirect method removes the need for creating a controller or a closure function only to return a redirect the page or response:


We can also pass the third argument, if we do not pass it, then by default its value is 301. However, you can pass a different status code. For example, if you want to create a temporary redirect with 307 status code, then the method will like this:

The Route::view method

The Route::view method remove the need of creating a controller or a closure function only to return a view. Now, You can define the URI and the Path to the view file to return the view.

We can also pass the array of variables to the view. The method will look like this:

Thanks For reading this post maybe this post will help you. for more detail, you can visit laravel official website

1 Comment

  • Sangeet Kumar Reply

    November 2, 2017 at 5:14 pm

    Thanks Sir
    This is code very helpful for me

Leave a Comment


Welcome! Login in to your account

Remember me Lost your password?

Lost Password