*/ class GroupFactory extends Factory { /** * The name of the factory's corresponding model. * * @var string */ protected $model = Group::class; /** * Define the model's default state. * * @return array */ public function definition(): array { // 使用中文 Faker 生成器 $faker = \Faker\Factory::create('zh_CN'); // 生成中文分组名称(使用公司名或部门名) $groupNames = [ '技术部', '市场部', '人力资源部', '财务部', '运营部', '产品部', '设计部', '客服部', '研发中心', '销售部', ]; return [ 'name' => $faker->randomElement($groupNames) . ' - ' . $faker->company(), 'description' => $faker->sentence(10), ]; } }