Join Joseph Lowery for an in-depth discussion in this video Inserting data programmatically, part of Laravel 4 Essential Training.
- Again, I'm gonna hearken back…to referring to Laravel as an MVC framework.…We've covered the V, View,…and C, Controller.…So now it's time for the M,…which stands for Model.…We'll use a model based on the Eloquent class…to provide a general structure for our table,…and it's so simple, you won't believe it.…To start, we'll create a file…within the app, models folder.…Just to show you there's only one there,…and I'll right-click on models…and then choose New File.…
And I'm gonna call it Paintings.php.…I'll open it up with a php tag,…and then define a class called Paintings…which extends Eloquent,…and after I add the requisite curly braces, I'm done.…Seriously, that's all it takes…to set up a model in Laravel.…With our table created via migrations,…and the related model declared,…we're ready to actually insert…our first record of data,…and the amazing thing is,…it won't take a lick of SQL.…
So, let's open our HomeController.php file…from the app, controllers file…that we previously created and have been working with,…and I'm gonna scroll down…
Need a quick dive into Laravel? Check out this short primer, Up and Running with Laravel.
- Installing Laravel and Composer
- Routing requests
- Filtering routes
- Incorporating advanced controllers
- Creating a basic Blade template
- Developing a layout with child pages and forms
- Integrating a database
- Creating tables via migrations
- Outputting data
- Building a Laravel app
- Authenticating users
- Deploying Laravel code
Skill Level Intermediate
Q: In the "Installing Laravel" video, the author provides instructions for changing permissions on the web server directory, as well as setting up a new project and cd-ing to the new app directory, using commands on a Mac. What commands do I type in Windows?
1. Introduction to Laravel
2. Fundamental Laravel Concepts
3. Outputting Laravel Code
4. Integrating Databases
5. Querying Data with Eloquent ORM
6. Building a Laravel App
7. Deploying Your Laravel Code
- 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.