laravel 使用测试工厂Factory添加测试数据
1. 只需要在 config\app.php 文件中加入 faker_locale => 'zh_CN' ,可生成部分中文数据,如 name address 等
2. 时间生成,当月随机时间
$faker->dateTimeThisMonth()
3. 随机数
rand(1, 5)
'id'=>$faker->randomElement(['1','2','3'])
1. 只需要在 config\app.php 文件中加入 faker_locale => 'zh_CN' ,可生成部分中文数据,如 name address 等
2. 时间生成,当月随机时间
$faker->dateTimeThisMonth()
3. 随机数
rand(1, 5)
'id'=>$faker->randomElement(['1','2','3'])