In this video, Justin demonstrates how to write your very first action in Laravel. This is where you use your prior skills in writing a route and a controller to make your Laravel application bend to your will.
- [Instructor] Now that we have a route … and we have our controller, let's actually … build out a real controller action. … Let's open up our controller we're working with … at app HTTP controllers showrooms controller dot PHP. … What we want to do here is build a JSON listing … of the rooms available in our hotel. … We can do that by accessing our database … and finding all of the records in the rooms table. … Laravel has an awesome tool in its kit called facades. … Facades help us access some common classes … without needing to worry about how it's loading … or what needs to be configured. … We'll use the facade for the database … to access the rooms table, return the data, … and then list it in a JSON response. … First off, write on line six to load in our facade … for the database in this class with use illuminate … backslash support backslash facades backslash DB. … This will load our DB facade into this class … so now we can use it. … We'll erase line 18 and in its place we'll do …
- Exploring Laravel
- Setting up simple authentication
- Controllers and routes
- Create and index view
- Show, edit, and destroy views
- Writing scopes in Laravel Eloquent
- Creating one-to-one relationships
Skill Level Beginner
MVC Frameworks for Building PHP Web Applicationswith Drew Falkman2h 57m Intermediate
Ajax with PHP: Add Dynamic Content to Websiteswith Kevin Skoglund3h 37m Intermediate
What you should know1m 52s
2. Starting Your Project
3. The Create and Index Views
4. The Show, Edit, and Destroy Views
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.