feat(desfile): export entry reservations
This commit is contained in:
@@ -29,6 +29,29 @@ class EntryReservationService
|
||||
{
|
||||
abort_unless($user->tenant_codigo === 'desfile_pura_tendencia', 403);
|
||||
|
||||
return $this->reservationsQuery($user, $filters)
|
||||
->paginate(
|
||||
perPage: $filters['per_page'] ?? 15,
|
||||
pageName: 'page',
|
||||
page: $filters['page'] ?? 1,
|
||||
)
|
||||
->withQueryString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array{tipo_pago?: string|null} $filters
|
||||
* @return Collection<int, EntryReservation>
|
||||
*/
|
||||
public function reservationsForExport(User $user, array $filters = []): Collection
|
||||
{
|
||||
abort_unless($user->tenant_codigo === 'desfile_pura_tendencia', 403);
|
||||
|
||||
return $this->reservationsQuery($user, $filters)->get();
|
||||
}
|
||||
|
||||
/** @param array{tipo_pago?: string|null} $filters */
|
||||
private function reservationsQuery(User $user, array $filters = []): Builder
|
||||
{
|
||||
return EntryReservation::query()
|
||||
->whereHas('variant.catalogItem', fn (Builder $query): Builder => $query
|
||||
->where('tenant_code', $user->tenant_codigo)
|
||||
@@ -44,13 +67,7 @@ class EntryReservationService
|
||||
'variant.eventDate',
|
||||
])
|
||||
->orderByDesc('fecha_reserva')
|
||||
->orderByDesc('id')
|
||||
->paginate(
|
||||
perPage: $filters['per_page'] ?? 15,
|
||||
pageName: 'page',
|
||||
page: $filters['page'] ?? 1,
|
||||
)
|
||||
->withQueryString();
|
||||
->orderByDesc('id');
|
||||
}
|
||||
|
||||
/** @param list<array{variant_id: int, tipo_pago: string}> $rows */
|
||||
|
||||
Reference in New Issue
Block a user