Basic signup for events
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user