Laravel 5.5 – The Route::view method

Laravel 5.5 introduced new Router class method called view, which gives the flexibility to render the view file directly without creating a controller or closure. This is not a great big feature, but it simplifies your code and removes a couple of files.

How to use Route::view()

Let’s define a route with Route::view, to access contact page. with the use of Route::view, we don’t have to define the controller or a closure to render a view, you can define a URI and a path to a view file.

How to Pass data to view

You can also pass in an array of variables as 3rd paramter that will be passed to the view

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.