laravel5.4进行数据填充,也就是批量填充测试数据

第一步:/database/factories/  目录下有个ModelFactory.php 文件

第二步:在shell  里  用命令   php artisan tinker

第三步:factory(App\Post::class,20)->create();  这个语句是直接写到数据库里的

而factory(App\Post::class,20)->make();   是打印在页面上的

猜你喜欢

转载自blog.csdn.net/qq_40270754/article/details/88942036