Basic implementation of payment methods

This commit is contained in:
2026-07-28 16:09:38 +02:00
parent 6c9281516e
commit ab3d526217
13 changed files with 34 additions and 15 deletions
+3 -1
View File
@@ -37,6 +37,8 @@ class AvailablePaymentMethod extends InstancedModel
public function events(): BelongsToMany
{
return $this->belongsToMany(Event::class, 'event_payment_methods')->withTimestamps();
// Pivot verknüpft über den Slug -- Event::paymentMethods() greift daher automatisch nur
// auf Events des aktuell gebundenen Tenants zu (SiteScope auf Event + AvailablePaymentMethod).
return $this->belongsToMany(Event::class, 'event_payment_methods', 'slug', 'event_id', 'slug', 'id')->withTimestamps();
}
}
+4 -1
View File
@@ -154,7 +154,10 @@ class Event extends InstancedModel
}
public function paymentMethods() : BelongsToMany {
return $this->belongsToMany(AvailablePaymentMethod::class, 'event_payment_methods', 'event_id', 'available_payment_method_id')->withTimestamps();
// Pivot verknüpft über den Slug (payment_methods.slug), nicht über die numerische id
// von available_payment_methods -- die tenant-spezifische Instanz wird dadurch implizit
// über den globalen SiteScope von AvailablePaymentMethod (gefiltert auf app('tenant')) aufgelöst.
return $this->belongsToMany(AvailablePaymentMethod::class, 'event_payment_methods', 'event_id', 'slug', 'id', 'slug')->withTimestamps();
}
public function resetContributingLocalGroups() {