availablePaymentMethod = $availablePaymentMethod; } public function toArray($request) : array { // Wird die Instanz über Event::paymentMethods() geladen, liegt die pro-Event-Konfiguration // im Pivot; ansonsten (Tenant-Kontext) gilt die Konfiguration der Instanz selbst. $pivot = $this->availablePaymentMethod->pivot ?? null; $configuration = $pivot !== null ? ($pivot->configuration ?? []) : ($this->availablePaymentMethod->configuration ?? []); return [ 'id' => $this->availablePaymentMethod->id, 'slug' => $this->availablePaymentMethod->slug, 'name' => $this->availablePaymentMethod->name, 'description' => $this->availablePaymentMethod->description, 'active' => $this->availablePaymentMethod->active, 'configuration' => (object) $configuration, 'optionsSchema' => PaymentMethod::optionsFor($this->availablePaymentMethod->slug), 'participantOptionsSchema' => PaymentMethod::participantOptionsFor($this->availablePaymentMethod->slug), ]; } }