localizationlaravel-5.1faker

Model Factory generating Latin results, not English and not accepting any other locale


I've built my model factory and it's working nicely, however, the generated sentences, words and other strings are in Latin, and I've searched the following solutions (which aren't working for me):

And still non-English results like: Soluta doloremque in consequatur.

What is strange is that in vendor/fzaninotto/faker/src/Faker/Factory.php class

the first line is const DEFAULT_LOCALE = 'en_US';

with create function public static function create($locale = self::DEFAULT_LOCALE)

Do I've to run something before doing some change?

I need help I've reached a dead end with this!

Update:

When I run the factory on User model it runs with locale sat in AppServiceProvider and the default it truly English, however, the other model that I got under User in ModelFactory.php is the one with Latin results only.

here is the code for both:

// English, settable
$factory->define(App\Models\User::class, function (Faker\Generator $faker) {
    return [
        'name' => $faker->name,
        'email' => $faker->email,
        'password' => bcrypt(str_random(10)),
        'remember_token' => str_random(10),
    ];
});

// Obligately Latin   
$factory->define(App\Models\Application::class, function (Faker\Generator $faker) {
    return [
        'title' => $faker->sentence('3'),
        'description' => $faker->paragraph,
        'field_id' => $faker->numberBetween(1,3),
        'published_at' => $faker->dateTimeBetween('-1 years'),
        'icon_url' => $faker->imageUrl(256, 256),
        'cover_url' => $faker->imageUrl(888, 444),
        'android_url' => $faker->url,
        'ios_url' => $faker->url,
        'windows_url' => $faker->url,
        'android_download_count' => $faker->randomDigit,
    ];
});

And I've compared those two models, nothing suspicious with it.


Solution

  • This is a limitation of the faker package which Laravel uses to generate database seeds.

    Both "sentence" and "paragraph" are included in the Lorem provider of faker. This is exclusively Latin language and cannot be changed to another language.