Currently, in my ModelFactory.php, I have:
$factory->define(App\Reply::class, function (Faker\Generator $faker) {
return [
'thread_id' => 1,
'user_id' => 1,
'body' => $faker->paragraph
];
});
I would like to generate a random user_id from one of the user ID's already stored in the user table. I'm stumped because I don't know the way to display data output to code properly, and I was wondering how I would be able to allow Laravel to choose a random user ID and insert into the database. Thank you! :)
$faker->numberBetween(1, 1000),
orrandom_int(1, 1000)
considering that you have 1000 users. – Besprent