Skip to content

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 ⭐️

892 B
Raw Blame
<?php

namespace HiEvents\Enterprise\BoxOffice\Http\Actions;

use HiEvents\DomainObjects\EventDomainObject;
use HiEvents\Enterprise\BoxOffice\Resources\BoxOfficeResource;
use HiEvents\Enterprise\BoxOffice\Services\Application\Handlers\GetBoxOfficeHandler;
use HiEvents\Http\Actions\BaseAction;
use Illuminate\Http\JsonResponse;

class GetBoxOfficeAction extends BaseAction
{
    public function __construct(
        private readonly GetBoxOfficeHandler $getBoxOfficeHandler,
    ) {}

    public function __invoke(int $eventId, int $boxOfficeId): JsonResponse
    {
        $this->isActionAuthorized($eventId, EventDomainObject::class);

        return $this->resourceResponse(
            resource: BoxOfficeResource::class,
            data: $this->getBoxOfficeHandler->handle(
                boxOfficeId: $boxOfficeId,
                eventId: $eventId,
            ),
        );
    }
}