GUI for Participant management

This commit is contained in:
2026-04-07 22:27:47 +02:00
parent 653e85b781
commit e6bd8c684d
20 changed files with 965 additions and 153 deletions

View File

@@ -4,6 +4,7 @@ namespace App\Repositories;
use App\Enumerations\EatingHabit;
use App\Models\Event;
use App\Models\EventParticipant;
use Illuminate\Http\Request;
class EventParticipantRepository {
@@ -16,6 +17,41 @@ class EventParticipantRepository {
return $participants;
}
public function getByIdentifier(string $identifier, EventRepository $eventRepository, bool $withPermissionCheck = true) : ?EventParticipant {
$participant = EventParticipant::where('identifier', $identifier)->first();
if ($participant === null) {
return null;
}
if ($withPermissionCheck) {
$event = $eventRepository->getById($participant->event_id);
if ($event === null) {
return null;
}
}
return $participant;
}
public function groupByLocalGroup(Event $event, Request $request) : array {
$allParticipants = $this->getForList($event, $request);
$participants = [];
foreach ($allParticipants as $participant) {
$participants[$participant['localgroup']][] = $participant;
}
return $participants;
}
public function groupByParticipationType(Event $event, Request $request) : array {
$allParticipants = $this->getForList($event, $request);
$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) {