validated('event_id'); $tickets = $this->userTickets->tickets( $tenant, $request->user(), $eventId === null ? null : (int) $eventId, ); return TicketResource::collection($tickets)->response(); } public function events(Request $request, Tenant $tenant): AnonymousResourceCollection { abort_unless($tenant->storefront_website_type_code === 'onticket_multi_event', 404); return TicketEventResource::collection( $this->userTickets->events($tenant, $request->user()) ); } public function downloadPdf(DownloadTicketsPdfRequest $request, Tenant $tenant): Response { $ticketIds = $request->validated('ticket_ids'); $tickets = Ticket::query() ->where('tenant_code', $tenant->codigo) ->where('user_id', $request->user()->getKey()) ->whereIn('id', $ticketIds) ->with([...TicketValidityResolver::RELATIONS, ...TicketPresentationResolver::RELATIONS]) ->orderByDesc('id') ->get(); if ($tickets->count() !== count($ticketIds)) { throw new TicketNotAvailableException(__('api.ticket.not_available')); } return $this->ticketPdfService->download($tenant, $tickets); } }