Basic signup for events

This commit is contained in:
2026-03-21 21:02:15 +01:00
parent 23af267896
commit b8341890d3
74 changed files with 4046 additions and 947 deletions

View File

@@ -7,6 +7,7 @@ use App\Models\CostUnit;
use App\Models\Event;
use App\Resources\CostUnitResource;
use Illuminate\Database\Eloquent\Collection;
use Psy\Readline\Hoa\EventBucket;
class EventRepository {
public function listAll() : array {
@@ -16,6 +17,17 @@ class EventRepository {
}
public function getAvailable(bool $accessCheck = true) : array {
return $this->getEventsByCriteria([
'archived' => false,
'registration_allowed' => true
],$accessCheck);
}
public function getForRegistration(int $id) : ?Event {
$events = self::getEventsByCriteria(['id' => $id, 'registration_allowed' => true]);
}
public function getById(int $id, bool $accessCheck = true) : ?Event {
$events = self::getEventsByCriteria(['id' => $id], $accessCheck);
return $events[0] ?? null;
@@ -50,7 +62,7 @@ class EventRepository {
/** @var Event $event */
foreach (Event::where($criteria)->get() as $event) {
if ($event->eventManagers()->where('user_id', $user->id)->exists() || $canSeeAll || !$accessCheck) {
if ($canSeeAll || !$accessCheck || $event->eventManagers()->where('user_id', $user->id)->exists()) {
$visibleEvents[] = $event;
}
}