GUI for Participant management
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user