I'm working with the Faker extension in Laravel 5 to populate my database.
I have "countries" and "Cities" tables so I called
$faker->country
but how can I get a city that is inside that country?
I don't want "Bogotá" to belong to "EEUU".
The epic of one of the most beloved open source JS libraries took a quick turn to the dark side. On the 5th of January 2022, a new version of Faker was released by Marak, versioned intentionally 6.6. 6. This marked the unforeseen extinction of the library which was essentially completely deleted from NPM and Github.
faker. js is a JavaScript library for generating fake data. Fake data is useful when building and testing our application. The faker. js can generate fake data for various areas, including address, commerce, company, date, finance, image, random, or name.
You'd make a generator and add only the provider for that country (a list of them can be found here):
$faker = new Faker\Generator();
$faker->addProvider(new Faker\Provider\en_AU\Address($faker));
$faker->state; // will give you only Australian states
If your specific need isn't covered by the available providers, you may need to create a custom provider.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With