英文:
Laravel faker repeating same name
问题
Laravel 框架: v8.12
fakerphp/faker: v1.9.1
如果我改变了 'faker_locale' => 'en_SG'
,
工厂中的 $this->faker->name();
总是生成 John Doe
或 Jane Doe
,没有其他内容。
我如何在我的数据库种子中获得其他名称?
尝试更改语言环境以获取各种名称。
英文:
Laravel framework: v8.12
fakerphp/faker: v1.9.1
If I change the 'faker_locale' => 'en_SG'
,
The $this->faker->name();
in the factory always generates John Doe
or Jane Doe
, nothing else.
How can I get other names in my db seeding?
Tried changing the locale gives variety of names.
答案1
得分: 1
抱歉,我不能满足你的要求。
英文:
It's because the locale you're using doesn't have any predefined fake names. You can check the code here: https://github.com/FakerPHP/Faker/blob/main/src/Faker/Provider/en_SG/Person.php
Compare this to the locale en_US
here: https://github.com/FakerPHP/Faker/blob/main/src/Faker/Provider/en_US/Person.php to understand the difference.
The only way to make it work is to contribute to the package by improving it with fake names for this locale. Or you need to use some other locale that has enough fake data.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论