Basic implementation of payment methods
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user