Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Laravel 5.x Cookbook

You're reading from  Laravel 5.x Cookbook

Product type Book
Published in Sep 2016
Publisher Packt
ISBN-13 9781786462084
Pages 402 pages
Edition 1st Edition
Languages
Authors (2):
Terry Matula Terry Matula
Profile icon Terry Matula
Alfred Nutile Alfred Nutile
Profile icon Alfred Nutile
View More author details

Table of Contents (17) Chapters

Laravel 5.x Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
1. Setting Up and Installing Laravel 2. Using Composer Packages 3. Routing 4. Building Views and Adding Style 5. Working with Data 6. Adding Angular to Your App 7. Authentication, Security, and Subscriptions 8. Testing and Debugging Your Application 9. Adding Advanced Features to Your App 10. Deploying Your App Index

Adding a static page


I will cover how easy it is to add a static page. We will look at several approaches.

Getting started…

We have a base install from all the previous work done and an About link. We are going to make that work.

How to do it…

  1. I will show three ways. This first way, we just put a file in the public folder called about.html and just type in there Foo. Then visit https://recipes.dev/about.html and you see something not that elegant, but it shows you how easy it is to bypass Laravel altogether. It's a good example of making an error message or site is down for maintenance message.

  2. The next one is a bit more common. We will make a route that will just return Foo to the page.

  3. Then, finally, we use a real View placing the file here: resources/views/about.blade.php.

  4. And then make the file look like the following:

  5. Then update the route file to return this view, no need for a controller for this:

  6. Then visit https://recipes.dev/about and you should see this (could use some serious copy help...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}