Seeding Your Database

Problem

You want to seed your database.

You've already written your database seeds and now you want to tell Laravel to seed the database.

Solution

Use the php artisan db:seed command.

$ php artisan db:seed

If you're using a different class than default for the root seeder, you can use the --class option.

$ php artisan db:seed --class=MyDatabaseSeeder

Discussion

Seeding is usually done for testing.

It's a great way to generate a standard set of records on your development machine.

comments powered by Disqus