Participant mangement

This commit is contained in:
2026-04-11 22:17:38 +02:00
parent e6bd8c684d
commit ed7f887e3a
47 changed files with 1641 additions and 269 deletions

View File

@@ -8,9 +8,16 @@ use App\Models\EventParticipant;
use Illuminate\Http\Request;
class EventParticipantRepository {
public function getForList(Event $event, Request $request) : array {
public function getForList(Event $event, Request $request, bool $signedOffParticipants = false) : array {
$participants = [];
foreach ($event->participants()->orderBy('lastname')->orderBy('firstname')->get() as $participant) {
if (!$signedOffParticipants) {
$allParticipants = $event->participants()->whereNull('unregistered_at');
} else {
$allParticipants = $event->participants()->whereNotNull('unregistered_at');
}
foreach ($allParticipants->orderBy('lastname')->orderBy('firstname')->get() as $participant) {
$participants[] = $participant->toResource()->toArray($request);
};
@@ -52,6 +59,16 @@ class EventParticipantRepository {
return $participants;
}
public function getSignedOffParticipants(Event $event, Request $request) : array {
$allParticipants = $this->getForList($event, $request, true);
$participants = [];
foreach ($allParticipants as $participant) {
$participants[$participant['participationType']][] = $participant;
}
return $participants;
}
public function getParticipantsWithIntolerances(Event $event, Request $request) : array {
$participants = [];
foreach ($event->participants()->whereNotNull('intolerances')->whereNot('intolerances' , '=', '')->get() as $participant) {