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\EventLocationDomainObject;
use HiEvents\DomainObjects\EventOccurrenceDomainObject;
use HiEvents\DomainObjects\Generated\AttendeeDomainObjectAbstract;
use HiEvents\DomainObjects\LocationDomainObject;
use HiEvents\DomainObjects\ProductDomainObject;
use HiEvents\DomainObjects\ProductPriceDomainObject;
use HiEvents\Http\Actions\BaseAction;
use HiEvents\Repository\Eloquent\Value\Relationship;
use HiEvents\Repository\Interfaces\AttendeeRepositoryInterface;
use HiEvents\Resources\Attendee\AttendeeResourcePublic;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Response;
class GetAttendeeActionPublic extends BaseAction
{
private AttendeeRepositoryInterface $attendeeRepository;
public function __construct(AttendeeRepositoryInterface $attendeeRepository)
{
$this->attendeeRepository = $attendeeRepository;
}
/**
* @todo move to handler
*/
public function __invoke(int $eventId, string $attendeeShortId): JsonResponse|Response
{
$attendee = $this->attendeeRepository
->loadRelation(new Relationship(
domainObject: ProductDomainObject::class,
nested: [
new Relationship(
domainObject: ProductPriceDomainObject::class,
),
], name: 'product'))
->loadRelation(new Relationship(
domainObject: EventOccurrenceDomainObject::class,
nested: [
new Relationship(
domainObject: EventLocationDomainObject::class,
nested: [
new Relationship(domainObject: LocationDomainObject::class, name: 'location'),
],
name: 'event_location',
),
],
name: 'event_occurrence',
))
->findFirstWhere([
AttendeeDomainObjectAbstract::SHORT_ID => $attendeeShortId,
]);
if (! $attendee) {
return $this->notFoundResponse();
}
return $this->resourceResponse(AttendeeResourcePublic::class, $attendee);
}
}