What is database seeding in Laravel?

后端 未结 2 1910
误落风尘
误落风尘 2021-01-02 12:01

I use Laravel framework and I have recently been informed that there is something named database seeding which produces a fake dataset for our tests. Is my unde

2条回答
  •  天命终不由人
    2021-01-02 12:19

    Usually you're using model Factories and faker to create fake data (with relations etc) for developing and testing your app.

    If you want to seed real data, just use commands to import dump. Or, if your data is something like table with countries, create seeder which inserts the real data without using faker or model factory.

    Also, you can use some package to create seeder from real data.

    You may want to read the docs on seeding.

提交回复
热议问题