Laravel 5.8 Tutorial From Scratch – e38 – Database & Table Seeders


A database seeder is comprised of all of the necessary code to generate a world’s worth of data for our app. A table seeder is an individual seeder for a particular table. Learn all about both of us, in this lesson.

For the best experience, follow along in our interactive school at

DigitalOcean Referral

Course Source Code

Hit us up on Twitter with any questions or comments @codertape (

About This Course

Ready to get started on your path to Laravel Artisan? In this series, we are breaking down all of the basics of Laravel to get you comfortable using the world’s most popular PHP framework. Let’s get started!


Xem thêm bài viết khác:


  1. Great tutorial .. You are the best
    I get an error :
    Call to undefined method AppCustomer::setContainer()
    Can i get help .. Thanks in advance.

  2. I had an issue with the php artisan db:seed command at 4:00, the issue was solved by typing the 'composer dump-autoload' command first.
    EDIT: I now see this was mentioned at the end of the video but I didn't want to continue the course until I solved the issue first.

  3. Again, Thank you so much for the tutorial. Best LARAVEL TUTORIAL. One thing, I'm new at laravel. It would be better to introduce that database app or (Sequel Pro – free) to us and connect to it before showing to us. I'm really sorry. I'm new here. Maybe this is a nonsense comment.

  4. Company makes redundancy but I tried this way 'company_id' =>function() { return AppCompany::all()->random(); }, and it is little bit done.

  5. Thanks, clear explanation. A small addition for the customers factory: 'Company_foreign_key' => function() { return Company::all()->random(); }. This has two advantages. You are not creating a company in your customer factory. A company will be seeded with 0, 1 or more customers (instead of exactly 1). Maybe this will help someone…


Please enter your comment!
Please enter your name here