feature/cierres (#30)
Reservas agregar y aprobar Co-authored-by: Juan Pablo Vial <jpvialb@incoviba.cl> Reviewed-on: #30
This commit is contained in:
47
app/tests/extension/Seeds/Unidades.php
Normal file
47
app/tests/extension/Seeds/Unidades.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
namespace Tests\Extension\Seeds;
|
||||
|
||||
use Tests\Extension\AbstractSeed;
|
||||
|
||||
class Unidades extends AbstractSeed
|
||||
{
|
||||
public function getDependencies(): array
|
||||
{
|
||||
return [
|
||||
ProyectoTipoUnidad::class,
|
||||
];
|
||||
}
|
||||
|
||||
public function run(): void
|
||||
{
|
||||
$ptus = $this->loadValues('proyecto_tipo_unidad', columns: ['id', 'proyecto', 'tipo', 'm2', 'logia', 'terraza']);
|
||||
|
||||
$data = [];
|
||||
foreach ($ptus as $s => $ptu) {
|
||||
$count = $this->faker->numberBetween(1, 10);
|
||||
$abr = $this->faker->word;
|
||||
$orientation = $this->faker->randomElement(['N', 'NO', 'NP', 'S', 'SO', 'SP', 'P', 'O']);
|
||||
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$data[] = [
|
||||
'proyecto' => $ptu['proyecto'],
|
||||
'tipo' => $ptu['tipo'],
|
||||
'subtipo' => $s,
|
||||
'piso' => $i + 2,
|
||||
'descripcion' => ($i + 2) * 100 + $s,
|
||||
'abreviacion' => $abr,
|
||||
'm2' => $ptu['m2'],
|
||||
'logia' => $ptu['logia'],
|
||||
'cubierta' => 0,
|
||||
'terraza' => $ptu['terraza'],
|
||||
'orientacion' => $orientation,
|
||||
'costo_inmobiliaria' => $this->faker->randomFloat(2, 1000, 3000),
|
||||
'pt' => $ptu['id'],
|
||||
'valor' => $this->faker->randomFloat(2, 1000, 3000),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$this->table('unidad')->insertValues($data)->save();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user