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\Http\Actions\Attendees;
use HiEvents\DomainObjects\EventDomainObject;
use HiEvents\Exceptions\CannotCheckInException;
use HiEvents\Http\Actions\BaseAction;
use HiEvents\Http\Request\Attendee\CheckInAttendeeRequest;
use HiEvents\Http\ResponseCodes;
use HiEvents\Resources\Attendee\AttendeeResource;
use HiEvents\Services\Application\Handlers\Attendee\CheckInAttendeeHandler;
use HiEvents\Services\Application\Handlers\Attendee\DTO\CheckInAttendeeDTO;
use Illuminate\Http\JsonResponse;
class CheckInAttendeeAction extends BaseAction
{
public function __construct(
private readonly CheckInAttendeeHandler $checkInAttendeeHandler
) {}
/**
* @deprecated This endpoint only sets a legacy flag on the attendee. The check-in isn't recorded on a check-in list, so it doesn't appear in the dashboard, check-in counts or exports, and no `checkin.created` or `checkin.deleted` webhook is sent. Use a check-in list instead: get the list's `short_id` from `GET /events/{eventId}/check-in-lists` (every event has a default list), then check attendees in with `POST /public/check-in-lists/{checkInListShortId}/check-ins` and out with `DELETE /public/check-in-lists/{checkInListShortId}/check-ins/{checkInShortId}`.
*/
public function __invoke(CheckInAttendeeRequest $request, int $eventId, string $attendeePublicId): JsonResponse
{
$this->isActionAuthorized($eventId, EventDomainObject::class);
$user = $this->getAuthenticatedUser();
try {
$attendee = $this->checkInAttendeeHandler->handle(CheckInAttendeeDTO::fromArray([
'event_id' => $eventId,
'attendee_public_id' => $attendeePublicId,
'checked_in_by_user_id' => $user->getId(),
'action' => $request->validated('action'),
]));
} catch (CannotCheckInException $e) {
return $this->errorResponse($e->getMessage(), ResponseCodes::HTTP_CONFLICT);
}
return $this->resourceResponse(AttendeeResource::class, $attendee);
}
}