Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️
PHP attendize-alternativedoor-managementevent-check-inevent-managementevent-registrationevent-ticketingeventbrite-alternativeeventslaravelopen-sourcephpreactself-hostedsell-ticketssell-tickets-onlineticket-sellingticketing-systemtickettailor-alternativetito-alternative
<?php
namespace HiEvents\Services\Application\Handlers\CheckInList;
use HiEvents\DomainObjects\CheckInListDomainObject;
use HiEvents\DomainObjects\EventDomainObject;
use HiEvents\DomainObjects\ProductDomainObject;
use HiEvents\Repository\Eloquent\Value\Relationship;
use HiEvents\Repository\Interfaces\CheckInListRepositoryInterface;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
class GetCheckInListHandler
{
public function __construct(
private readonly CheckInListRepositoryInterface $checkInListRepository,
) {}
public function handle(int $checkInListId, int $eventId): CheckInListDomainObject
{
$checkInList = $this->checkInListRepository
->loadRelation(ProductDomainObject::class)
->loadRelation(new Relationship(domainObject: EventDomainObject::class, name: 'event'))
->findFirstWhere([
'event_id' => $eventId,
'id' => $checkInListId,
]);
if ($checkInList === null) {
throw new ResourceNotFoundException(__('Check-in list not found'));
}
$attendeeCheckInCount = $this->checkInListRepository->getCheckedInAttendeeCountById($checkInList->getId());
$checkInList->setCheckedInCount($attendeeCheckInCount->checkedInCount ?? 0);
$checkInList->setTotalAttendeesCount($attendeeCheckInCount->totalAttendeesCount ?? 0);
return $checkInList;
}
}