get(); Video::factory(10)->make()->each(function (Video $video, int $key) use ($productModels) { if (rand(1, 10) > 5) { $video->product()->associate($productModels->random()->getKey()); } $video->order = $key + 1; $video->saveQuietly(); }); } }