December 7, 2016 —John Koster
db:seed command is used to add records to a database automatically using a
Illuminate\Database\Seeder) class to generate or provide the records. The
db:seed defines three options:
class option can be used to specify that a specific
Seeder class should be used. By default the
db:seed command will use the
DatabaseSeeder class; this class is defines in the
database option is used to specify which database connection is used when inserting the records. By default this option is set to value held in the
database.default configuration entry (which is set to
mysql by default).
force option is used to indicate that the
db:seed command should run in production. By default this option is set to
false and will warn you that the application is in running in a production environment.
The following examples demonstrate the various ways to call the
1# Run with all defaults. 2php artisan db:seed 3 4# Specify database connection. 5php artisan db:seed --database=staging 6 7# Specify a different seeder class. 8php artisan db:seed --seeder=ConfigurationSeeder 9 10# Force the seed while in production.11php artisan db:seed --force12 13# All together.14php artisan db:seed --database=staging --seeder=ConfigurationSeeder --force
The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.