Skip to content
Advertisement

localization FakerFactory does not work in laravel

I have a Post Model with these fields :

JavaScript

Now I want to use laravel sedders and model factories to create fake fa_IR localized data and insert to posts table.

For that I wrote this in database/factories/ModelFactory.php:

JavaScript

Then I created a PostsTableSeeder class like this :

JavaScript

And in AppServiceProvider.php added below codes to register function :

JavaScript

But After running the seed , laravel uses default locale (en_US) and ignores fa_IR.

I do not know what else to do.

Update:

Even I changed in DEFAULT_LOCALE const vendor/fzaninotto/faker/src/Faker/Factory.php to fa_IR Nothing changed.

Advertisement

Answer

Not all faker methods are supported in every language, from what a quick lookup of the documentation says, the Company and Address provider are supported in the fa_IR localization

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement