Join Joseph Lowery for an in-depth discussion in this video Seeding the database, part of Laravel 4 Essential Training (2014).
- Apps eat up data like crazy.…You often need to have a good amount of it…to develop an application,…for testing and general output.…In the previous lesson,…we entered a single record manually.…When you need a lot more data, and you will,…it's better to seed the database table.…Laravel has a built-in seeder accessible via Artisan…which, when coupled with an excellent package…that you can find via Composer,…handles this chore in a snap.…
First, though, we'll need to seed the seeder.…Take a look at the app database, seeds folder,…and there you'll find a file, DatabaseSeeder.php.…Open that up.…In the run function,…the first bit of code that you see on line 12…basically tells Eloquent to stand down…and allow multiple entries.…Next, the commented outline…points to a user database table seeder.…
But we're going to create our own seeder,…so let's leave that as it is.…Underneath it, add this pointer: call,…same syntax as above.…But what we're going to call…is PaintingsTableSeeder instead.…I'll save this file.…Now, let's just go create that file in the seeds folder.…
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.