refactor: integrate category handling for entries and food items in services and tests
This commit is contained in:
@@ -32,6 +32,16 @@ class FiestaFutbolInfantilProductSeeder extends Seeder
|
||||
Category::query()->where('tenant_code', $tenant->codigo)->update(['categoria_id' => null]);
|
||||
Category::query()->where('tenant_code', $tenant->codigo)->delete();
|
||||
|
||||
$categories = collect([
|
||||
'entradas' => 'Entradas',
|
||||
'alojamientos' => 'Alojamientos',
|
||||
'comidas' => 'Comidas',
|
||||
'merchandising' => 'Merchandising',
|
||||
])->map(fn (string $name): Category => Category::query()->create([
|
||||
'nombre' => $name,
|
||||
'tenant_code' => $tenant->codigo,
|
||||
]));
|
||||
|
||||
$tenant->update([
|
||||
'event_title' => 'Fiesta Nacional del Fútbol Infantil',
|
||||
'event_location' => 'Sunchales, Santa Fe',
|
||||
@@ -49,6 +59,7 @@ class FiestaFutbolInfantilProductSeeder extends Seeder
|
||||
$this->createProduct($tenant, [
|
||||
'slug' => 'camiseta',
|
||||
'nombre' => 'Camiseta',
|
||||
'category_id' => $categories['merchandising']->id,
|
||||
'precio' => 18000,
|
||||
'attribute_codes' => ['color', 'talle'],
|
||||
'variants' => collect(['Verde', 'Blanco'])
|
||||
@@ -62,6 +73,7 @@ class FiestaFutbolInfantilProductSeeder extends Seeder
|
||||
$this->createProduct($tenant, [
|
||||
'slug' => 'alojamiento',
|
||||
'nombre' => 'Alojamiento',
|
||||
'category_id' => $categories['alojamientos']->id,
|
||||
'precio' => 35000,
|
||||
'attribute_codes' => ['tipo_alojamiento'],
|
||||
'variants' => collect(['Carpa', 'Motorhome'])->map(fn (string $type): array => [
|
||||
@@ -73,6 +85,7 @@ class FiestaFutbolInfantilProductSeeder extends Seeder
|
||||
$this->createProduct($tenant, [
|
||||
'slug' => 'comida',
|
||||
'nombre' => 'Comida',
|
||||
'category_id' => $categories['comidas']->id,
|
||||
'precio' => 4000,
|
||||
'attribute_codes' => ['event_date', 'horario', 'servicio'],
|
||||
'variants' => $eventDates
|
||||
@@ -94,6 +107,7 @@ class FiestaFutbolInfantilProductSeeder extends Seeder
|
||||
$this->createProduct($tenant, [
|
||||
'slug' => 'abono',
|
||||
'nombre' => 'Abono',
|
||||
'category_id' => $categories['entradas']->id,
|
||||
'precio' => 40000,
|
||||
'event_product_type' => EventProductType::Entry->value,
|
||||
'has_tickets' => true,
|
||||
|
||||
Reference in New Issue
Block a user