How to get a route to directly show a view?

October 26, 2018

If you have a simple controller method that is just:

<?php
public function about_me() {
                return view('static.about_me');
                }

Then you can do the following in your routes file:

<?php
Route::view('/about','static.about_me');

This makes it a bit quicker to code. Sometimes it is common to end up with a bunch of functions (in a controller named something like StaticPagesController) that don't do anything apart from return a view. Using the Route::view method in your routes file means you can skip making that function.