I am trying to create seeders for testing purposes. I have users that belongs to a room via a room id, these rooms are created via a room seeder, in my users seeder, I create a user and update the room_id attribute like this,
factory(App\User::class, 150)->create([
'host' => false,
'room_id' => App\Room::inRandomOrder()->first()->id
]);
My problem is that all users generated here, all get the same room id, how can a truly get a random room id from the database and use it in my seeder?