Use Laravel seed and sql files to populate database

后端 未结 4 1653
忘了有多久
忘了有多久 2021-01-30 11:28

I got several .sql files of countries, states and cities of the world from github. How can I run them with Laravel\'s seed files to populate those tables in my database?

4条回答
  •  遥遥无期
    2021-01-30 12:04

    I found a package that creates seed files from database tables and rows. It currently supports Laravel 4, 5, 6 and 7:

    https://github.com/orangehill/iseed

    In the end, it's basically as easy as this:

    php artisan iseed my_table
    

    or for multiple occasions:

    php artisan iseed my_table,another_table
    

提交回复
热议问题