loadValues('proyecto', columns: 'id'); $types = $this->loadValues('tipo_unidad', columns: 'id'); $data = []; foreach ($projects as $project) { foreach ($types as $type) { $count = $this->faker->numberBetween(1, 10); for ($i = 0; $i < $count; $i++) { $name = $this->faker->word; $data []= [ 'proyecto' => $project, 'tipo' => $type, 'nombre' => $name, 'abreviacion' => substr($name, 0, 3), 'm2' => $this->faker->randomFloat(2, 10, 100), 'logia' => $this->faker->optional(.3, 0)->randomFloat(2, 1, 5), 'terraza' => $this->faker->optional(.3, 0)->randomFloat(2, 2, 30), 'descripcion' => $this->faker->sentence, ]; } } } $this->table('proyecto_tipo_unidad')->insertValues($data)->save(); } }