In this video, learn the skills needed to write a standard Laravel edit action, where you can retrieve and display a form to edit a record from the database.
- [Instructor] Our edit action is set up to permit us … to get the record for the booking … and then to render our view for the form … to then edit our booking record. … We actually saw a lot of this already … when we built the original store action. … But let's improve on it a bit. … Let's first view our controller method … in our app/Http/Controllers/BookingController.php. … Here on line 77 is our edit method. … Our edit method, similar to how the show method, … takes an instance of the booking model, … matching the record for the ID we get from the URL. … This edit function should look pretty similar … to how our controller method acts for store just as well. … In fact, we'll just copy the code from our store method. … We'll scroll up to lines 30 … through 34 … and copy that now … and paste that in for lines 79 through 83. … We only need to change a few things. … First, replace the view file … this function is going to render … by replacing on return view bookings.create … with return view bookings.edit. …
- 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.