refactor(event): move event configuration onto tenant

This commit is contained in:
2026-08-07 09:08:14 -03:00
parent 60b8415c59
commit 7b7efeb4cc
27 changed files with 433 additions and 271 deletions

View File

@@ -12,7 +12,6 @@ use App\Domains\Catalog\Models\CatalogItem;
use App\Domains\Catalog\Models\Category;
use App\Domains\Catalog\Models\FeaturedGroup;
use App\Domains\Catalog\Services\CatalogService;
use App\Domains\Event\Models\Event;
use App\Domains\Tenant\Models\Tenant;
use App\Domains\Ticket\Enums\ValidityTimeType;
use App\Domains\Ticket\Models\ValidityTime;
@@ -38,18 +37,15 @@ class FiestaFutbolInfantilProductSeeder extends Seeder
->update(['categoria_id' => null]);
Category::query()->where('tenant_code', $tenant->codigo)->delete();
$event = Event::query()->updateOrCreate(
[
'tenant_code' => $tenant->codigo,
'name' => 'Fiesta Nacional del Fútbol Infantil',
],
['address' => 'Sunchales, Santa Fe'],
);
$event->dates()->delete();
$tenant->update([
'event_title' => 'Fiesta Nacional del Fútbol Infantil',
'event_location' => 'Sunchales, Santa Fe',
]);
$tenant->eventDates()->delete();
$eventDates = collect(['2026-10-09', '2026-10-10', '2026-10-11', '2026-10-12'])
->mapWithKeys(function (string $date) use ($event): array {
$eventDate = $event->dates()->create([
->mapWithKeys(function (string $date) use ($tenant): array {
$eventDate = $tenant->eventDates()->create([
'date' => $date,
'time_start' => '00:00:00',
'time_end' => '23:59:59',
@@ -58,9 +54,6 @@ class FiestaFutbolInfantilProductSeeder extends Seeder
return [$date => $eventDate];
});
$tenant->active_event_id = $event->id;
$tenant->save();
$ticketCategory = Category::query()->firstOrCreate([
'nombre' => 'Entradas',
'tenant_code' => $tenant->codigo,
@@ -89,7 +82,6 @@ class FiestaFutbolInfantilProductSeeder extends Seeder
$generalAdmission = $this->catalogService->create([
'tenant_code' => $tenant->codigo,
'event_id' => $event->id,
'event_product_type' => EventProductType::Entry->value,
'category_id' => $ticketCategory->id,
'slug' => 'entrada-general',
@@ -121,7 +113,6 @@ class FiestaFutbolInfantilProductSeeder extends Seeder
foreach ($items as $item) {
$createdItems[$item['slug']] = $this->catalogService->create([
'tenant_code' => $tenant->codigo,
'event_id' => $event->id,
'event_product_type' => EventProductType::Product->value,
'descripcion' => $item['descripcion'] ?? $item['nombre'],
'inventory_policy' => InventoryPolicy::Unlimited->value,
@@ -133,7 +124,6 @@ class FiestaFutbolInfantilProductSeeder extends Seeder
$this->catalogService->create([
'tenant_code' => $tenant->codigo,
'event_id' => $event->id,
'event_product_type' => EventProductType::Entry->value,
'type' => CatalogItemType::Bundle->value,
'slug' => 'entrada-general-todos-los-dias',
@@ -152,7 +142,6 @@ class FiestaFutbolInfantilProductSeeder extends Seeder
$this->catalogService->create([
'tenant_code' => $tenant->codigo,
'event_id' => $event->id,
'event_product_type' => EventProductType::Product->value,
'type' => CatalogItemType::Bundle->value,
'slug' => 'combo-2-panchos-2-hamburguesas',