Skip to Main Content
Laravel 5 Essentials
book

Laravel 5 Essentials

by Martin Bean
April 2015
Beginner content levelBeginner
144 pages
3h 13m
English
Packt Publishing
Content preview from Laravel 5 Essentials

Back to the routes

Now that we have a main layout template that we can extend and re-use, we can start to create the individual routes of our application at app/Http/routes.php, along with the different views that will display the application data.

The overview page

This is the index page that is going to display all of the cats using the cats.index view. We will also re-use this view for the second route where cats are filtered by breed, since both the routes are almost identical. Note that Laravel expects you to use the dot notation (cats.index and not cats/index) to refer to a view located inside a subdirectory:

Route::get('cats', function() { $cats = Furbook\Cat::all(); return view('cats.index')->with('cats', $cats); }); Route::get('cats/breeds/{name}', ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning Laravel: A beginner's guide to application development with Laravel 5.3

Beginning Laravel: A beginner's guide to application development with Laravel 5.3

Sanjib Sinha
Laravel 5.x Cookbook

Laravel 5.x Cookbook

Terry Matula, Alfred Nutile

Publisher Resources

ISBN: 9781785283017Supplemental Content