Populating a database in a Laravel migration file

前端 未结 7 1876
不知归路
不知归路 2020-12-07 10:31

I\'m just learning Laravel, and have a working migration file creating a users table. I am trying to populate a user record as part of the migration:

public          


        
7条回答
  •  南方客
    南方客 (楼主)
    2020-12-07 11:29

    Here is a very good explanation of why using Laravel's Database Seeder is preferable to using Migrations: https://web.archive.org/web/20171018135835/http://laravelbook.com/laravel-database-seeding/

    Although, following the instructions on the official documentation is a much better idea because the implementation described at the above link doesn't seem to work and is incomplete. http://laravel.com/docs/migrations#database-seeding

提交回复
热议问题