In this video, Justin walks you through saving submitted form data as a new entry in your database.
- [Instructor] For submitting a form in Laravel, … we use a different action to process a submitted request. … This is one thing … that can make it easier to work with Laravel … is this clean separation … between different controller actions for even the same URL … but at a different HTTP request. … We'll start working this … with editing the BookingController … at app, Http, Controllers, BookingController.php. … We'll work on the store method on line 45 … and we'll put in dd, parentheses, … request, arrow, all. … This request, all, … gets all of the data back from our request. … If we go to our form in our browser … at homestead.test/bookings/create and fill it out, … you'll see the sample data provided in the request … that we submitted in the form. … Let's now get this data saved. … We'll go back to our controller … and on line 46, we'll add id … is equal to DB::table, … parentheses, and in single quotes, bookings, … arrow, insertGetId. … And then that insertGetId is going to take an array …
- 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.