Your instructor, Justin Yost, demonstrates the steps needed to retrieve and display a single record from the database for a Laravel application including dealing with missing records.
- [Instructor] Our show action is simply the action … we'll use to show an existing single record. … In our case it won't let us either edit … or delete the record. … Here's how it will work. … We'll open up our booking controller at App, HTTP, … Controllers, Booking controller dot PHP. … And on line 66 will be our show method. … This method takes an instance of booking. … This uses Laravel's route model binding … that we saw earlier to provide a way … providing automatic not found responses … in the event an ID doesn't match an existing record. … We've already seen this … already earlier in the course. … Let's add on line 68 … by removing the comment … and adding in dd booking … to dump our booking model instance. … Let's go to our browser … and click one of the view links … that we have visible on our page. … What we see here is a Laravel eloquent model instance … of our booking records. … Most of these properties that we're seeing listed here … are related to Laravel's understanding of models …
- 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.