Creados un monton de componentes para reutilizar en las paginas, modificadas vistas, faltan agregar mas cosas
This commit is contained in:
@@ -16,15 +16,36 @@ class ProductFactory extends Factory
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
$brands = ['Shimano', 'Venzo', 'Trek', 'Specialized', 'Maxxis', 'Sram', 'Raleigh'];
|
||||
$bikeModels = ['Loki', 'Marlin 5', 'Chisel', 'Talon 3', 'Aspect 950'];
|
||||
$accessories = ['Cadena 9v', 'Pedales Aluminio', 'Casco MTB', 'Luz Delantera USB', 'Cámara 29"', 'Cubierta Kevlar'];
|
||||
|
||||
$type = $this->faker->randomElement(['bike', 'accessory', 'service']);
|
||||
|
||||
// Generar nombre según el tipo
|
||||
if ($type === 'bike') {
|
||||
$name = $this->faker->randomElement($brands) . ' ' . $this->faker->randomElement($bikeModels);
|
||||
} elseif ($type === 'accessory') {
|
||||
$name = $this->faker->randomElement($accessories) . ' ' . $this->faker->randomElement(['Pro', 'Basic', 'Comp', 'Elite']);
|
||||
} else {
|
||||
$name = $this->faker->randomElement(['Service General', 'Ajuste Cambios', 'Centrado de Rueda', 'Lavado y Engrase']);
|
||||
}
|
||||
|
||||
// Lógica de Precios
|
||||
$price = $this->faker->numberBetween(5000, 800000);
|
||||
$cost = $price * $this->faker->randomFloat(2, 0.5, 0.7);
|
||||
|
||||
return [
|
||||
'nombre' => $this->faker->sentence(3),
|
||||
'marca'=> $this->faker->randomElement(['Cube','Giant','Megamo','KTM','MMR','Liv','Ghost','Lapierre']),
|
||||
'modelo'=> $this->faker->bothify('????-####'),
|
||||
'rodado'=> $this->faker->numberBetween(12,30),
|
||||
'color'=> $this->faker->safeColorName(),
|
||||
'tipo'=> $this->faker->word(),
|
||||
'descripcion'=> $this->faker->text(),
|
||||
'precio'=> $this->faker->randomFloat(2,100,200)
|
||||
'name' => $name,
|
||||
'sku' => strtoupper($this->faker->bothify('???-#####')),
|
||||
'description' => $this->faker->sentence(10),
|
||||
'price' => $price,
|
||||
'cost' => $cost,
|
||||
'stock_quantity' => $type === 'service' ? 0 : $this->faker->numberBetween(0, 50),
|
||||
'min_stock_alert' => $this->faker->numberBetween(2, 10),
|
||||
'type' => $type,
|
||||
// Nro de serie si es bicicleta
|
||||
'serial_number' => $type === 'bike' ? strtoupper($this->faker->bothify('##??##??')) : null,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user