Seeds
Learn to use seeds to add data in the database.
We'll cover the following
Seeds are used to populate the tables that we created using migrations, with data.
Creating a seed
Let’s create a seed to add a few records to our products
table that we created earlier. After the database is seeded, the table should look something like this:
id | name | price | created_datetime | updated_datetime |
---|---|---|---|---|
1 | Apple Mac Pro Stand | 999.00 | 2020-09-09 | NULL |
2 | Apple Macbook Bro 2019 | 1999.00 | 2020-09-09 | NULL |
Get hands-on with 1400+ tech skills courses.