relationLoaded('variant') ? $this->variant->selectionOptions() : collect(); return [ 'id' => $this->id, 'variant_id' => $this->variant_id, 'ticket_id' => $this->ticket_id, 'fecha_reserva' => $this->fecha_reserva->toIso8601String(), 'tipo_pago' => $this->tipo_pago->value, 'tipo_pago_label' => $this->tipo_pago->label(), 'importe' => $this->importe, 'entrada' => [ 'tipo' => $this->selectionLabel($selection->get('tipo')), 'sector' => $this->selectionLabel($selection->get('sector')), 'fila' => $this->selectionLabel($selection->get('fila')), 'asiento' => $this->selectionLabel($selection->get('asiento')), ], ]; } private function selectionLabel(mixed $selection): ?string { if (! is_array($selection)) { return null; } if (array_is_list($selection)) { $labels = collect($selection)->pluck('label')->filter()->implode(', '); return $labels !== '' ? $labels : null; } return isset($selection['label']) ? (string) $selection['label'] : null; } }