在做项目的时候有时候,
要进行大量的数据使用,
这时候手动添加的时候会浪费大量的时间
这时候就是体现数据填充的作用了
CREATE TABLE `admins` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`username` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `admins_username_unique` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
database\factories
下的UserFactory中复制:(或者自建表)php artisan tinker
原文:https://www.cnblogs.com/yaoliuyang/p/13068731.html