if you are seeding random test data, Laravel best practice recommends using model factories.
https://laravel.com/docs/8.x/database-testing#defining-model-factories
can you give some examples of what you want to have for your body field?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello guys i'm making seeder for my website and i need for my body column random text in three different langues.
DB::table('episodes')->insert([
'slug' => 'show-one-season-one-episode' . $i,
'title' => 'episode-name ' . $i,
'image' => $fakeDir . '/' . $fakeImg->random(),
'episode_number' => $i,
'season_id' => $showOneSeasonOne,
'body' => '', <---------- some code for three different languages
'view' => '2023213',
'published_at' => now(),
'created_at' => now(),
'updated_at' => now(),
]);
i have some code for images to get it randomly i want same but for text
You can dynamically create a new Faker instance with a locale string, e.g.:
$faker = Faker\Factory::create('de_DE');
$faker->realText; // locale-specific text
So in your case:
$locales = ['en_GB', 'ru_RU', 'ka_GE'];
$faker = Faker\Factory::create(Arr::random($locales));
$faker->realText; // locale-specific text
Please or to participate in this conversation.