This video gives you the tools to save updated records to the database from your submitted form.
- [Instructor] So we have an edit form at this point, … but we now need to actually update the data in our database. … We'll start in our controller. … So open up it at app, … Http, Controllers, BookingController.php. … On line 96 is our update method. … This code is going to look fairly similar … to our booking store method, … so let's go ahead and copy that code … from lines 45 through lines 57. … And paste it in as lines 98 through 110. … Now rather than an insert operation, … we'll want to run an update operation. … First we need to find … the record in the database for updating. … We just did this in the prior video with the where clause. … So we're going to add onto line 98 … in between the table call and the insertGetId call, … we'll add the new function arrow where, … and pass in id comma booking arrow id. … And we're going to replace … the insertGetId method on line 100 with update. … And that's pretty much it for our booking record. … Now update doesn't return an ID, … so we can delete that on line 98, …
- 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.