Support oft parent groups
This commit is contained in:
@@ -38,6 +38,7 @@ class EventParticipant extends InstancedModel
|
||||
'fee_type',
|
||||
'sibling_reduction',
|
||||
'local_group',
|
||||
'parent_group_id',
|
||||
'birthday',
|
||||
|
||||
'address_1',
|
||||
@@ -143,6 +144,22 @@ class EventParticipant extends InstancedModel
|
||||
return $this->belongsTo(Tenant::class, 'local_group', 'slug');
|
||||
}
|
||||
|
||||
/** Parent Group -- nur bei Veranstaltungen gesetzt, die danach statt nach der Local Group fragen. */
|
||||
public function parentGroup()
|
||||
{
|
||||
return $this->belongsTo(ParentGroup::class, 'parent_group_id');
|
||||
}
|
||||
|
||||
/** Anzeigename der bei der Anmeldung gewählten Gruppe, je nachdem, wonach die Veranstaltung fragt. */
|
||||
public function participantGroupName(Event $event) : string
|
||||
{
|
||||
if ($event->asksForParentGroup()) {
|
||||
return $this->parentGroup?->name ?? 'Keine Angabe';
|
||||
}
|
||||
|
||||
return $this->localGroup?->name ?? 'Nicht im LV';
|
||||
}
|
||||
|
||||
public function participationType()
|
||||
{
|
||||
return $this->belongsTo(ParticipationType::class, 'participation_type', 'slug');
|
||||
|
||||
Reference in New Issue
Block a user