seeder
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| seeder [2020/12/23 19:08] – chifek | seeder [2023/09/14 06:06] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 91: | Line 91: | ||
| } | } | ||
| </ | </ | ||
| + | |||
| + | **Running Seeders** | ||
| + | |||
| + | You may execute the `db:seed` Artisan command to seed your database. By default, the `db:seed` command runs the `Database\Seeders\DatabaseSeeder` class, which may in turn invoke other seed classes. However, you may use the --class option to specify a specific seeder class to run individually: | ||
| + | |||
| + | < | ||
| + | php artisan db:seed | ||
| + | |||
| + | php artisan db:seed --class=UserSeeder | ||
| + | </ | ||
| + | |||
| + | You may also seed your database using the `migrate: | ||
| + | |||
| + | < | ||
| + | php artisan migrate: | ||
| + | </ | ||
| + | |||
| + | **Forcing Seeders To Run In Production** | ||
| + | |||
| + | Some seeding operations may cause you to alter or lose data. In order to protect you from running seeding commands against your production database, you will be prompted for confirmation before the seeders are executed in the `production` environment. To force the seeders to run without a prompt, use the `--force` flag: | ||
| + | |||
| + | < | ||
seeder.1608750527.txt.gz · Last modified: 2023/09/14 06:06 (external edit)