Building a view based route

In the preceding recipe, we showed how to build a JSON-based API response in a route with a real view. I will show here just how simple it is in routes to output a View. Typically, I would use a controller but in this case I will not, just to show how you can experiment in a route at different levels.

Getting ready

A base install will be fine for this one.

How to do it…

  1. Let's add another route for this:
    How to do it…
  2. Then, make a view to handle that route resources/views/examples/route_view.blade.php:
    How to do it…
  3. And give it a look http://recipes.dev/example_view ...

Get Laravel 5.x Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.