我在整个ModelFactory的文件顶部和下面的位置都试了还是不行,生成出来的都是英文的。。
$faker = Faker\Factory::create('zh_CN');
$factory->define(App\Models\Article::class, function (Faker\Generator $faker) {
DB::table('article')->truncate();
return [
'title' => $faker->sentence,
'abstract' => $faker->sentence,
'content' => $faker->paragraph,
'image' => $faker->imageUrl(),
'created_user' => $faker->randomNumber(),
'updated_user' => $faker->randomNumber(),
'look_num' => $faker->randomNumber(),
'is_recommend' => round(rand(0,1)),
'is_show' => round(rand(0,1))
];
});