Laravel faker repeating same name

262 Views Asked by At

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

There are 1 best solutions below

0
sha-1 On

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.