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
declare(strict_types=1);
namespace HiEvents\Http\Actions\Events;
use HiEvents\DomainObjects\EventDomainObject;
use HiEvents\DomainObjects\EventLocationDomainObject;
use HiEvents\DomainObjects\EventOccurrenceDomainObject;
use HiEvents\DomainObjects\ImageDomainObject;
use HiEvents\DomainObjects\LocationDomainObject;
use HiEvents\DomainObjects\OrganizerDomainObject;
use HiEvents\DomainObjects\OrganizerSettingDomainObject;
use HiEvents\DomainObjects\ProductCategoryDomainObject;
use HiEvents\DomainObjects\ProductDomainObject;
use HiEvents\DomainObjects\ProductPriceDomainObject;
use HiEvents\DomainObjects\TaxAndFeesDomainObject;
use HiEvents\Enterprise\Seating\Services\Domain\EventSeatMapLookupService;
use HiEvents\Http\Actions\BaseAction;
use HiEvents\Repository\Eloquent\Value\Relationship;
use HiEvents\Repository\Interfaces\EventRepositoryInterface;
use HiEvents\Resources\Event\EventResource;
use Illuminate\Http\JsonResponse;
class GetEventAction extends BaseAction
{
public function __construct(
private readonly EventRepositoryInterface $eventRepository,
private readonly EventSeatMapLookupService $eventSeatMapLookupService,
) {}
public function __invoke(int $eventId): JsonResponse
{
$this->isActionAuthorized($eventId, EventDomainObject::class);
$event = $this->eventRepository
->loadRelation(new Relationship(domainObject: OrganizerDomainObject::class, nested: [
new Relationship(domainObject: OrganizerSettingDomainObject::class),
], name: 'organizer'))
->loadRelation(new Relationship(ImageDomainObject::class))
->loadRelation(new Relationship(domainObject: EventLocationDomainObject::class, name: 'event_location', nested: [
new Relationship(domainObject: LocationDomainObject::class, name: 'location'),
]))
->loadRelation(new Relationship(domainObject: EventOccurrenceDomainObject::class, nested: [
new Relationship(domainObject: EventLocationDomainObject::class, name: 'event_location', nested: [
new Relationship(domainObject: LocationDomainObject::class, name: 'location'),
]),
]))
->loadRelation(
new Relationship(ProductCategoryDomainObject::class, [
new Relationship(ProductDomainObject::class, [
new Relationship(ProductPriceDomainObject::class),
new Relationship(TaxAndFeesDomainObject::class),
]),
])
)
->findById($eventId);
$event->setHasSeatMap($this->eventSeatMapLookupService->existsForEvent($eventId));
return $this->resourceResponse(EventResource::class, $event);
}
}