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\Enterprise\BoxOffice\Http\Actions;
use HiEvents\DomainObjects\Enums\Permission;
use HiEvents\DomainObjects\EventDomainObject;
use HiEvents\Enterprise\BoxOffice\Http\Request\GetBoxOfficeStatsRequest;
use HiEvents\Enterprise\BoxOffice\Resources\BoxOfficeStatsResource;
use HiEvents\Enterprise\BoxOffice\Services\Application\Handlers\DTO\GetBoxOfficeStatsDTO;
use HiEvents\Enterprise\BoxOffice\Services\Application\Handlers\GetBoxOfficeStatsHandler;
use HiEvents\Http\Actions\BaseAction;
use HiEvents\Http\Attributes\RequiresPermission;
use Illuminate\Http\JsonResponse;
#[RequiresPermission(Permission::VIEW_FINANCIALS)]
class GetBoxOfficeStatsAction extends BaseAction
{
public function __construct(
private readonly GetBoxOfficeStatsHandler $getBoxOfficeStatsHandler,
) {}
public function __invoke(GetBoxOfficeStatsRequest $request, int $eventId, int $boxOfficeId): JsonResponse
{
$this->isActionAuthorized($eventId, EventDomainObject::class);
return $this->resourceResponse(
resource: BoxOfficeStatsResource::class,
data: $this->getBoxOfficeStatsHandler->handle(
new GetBoxOfficeStatsDTO(
event_id: $eventId,
box_office_id: $boxOfficeId,
from: $request->validated('from'),
to: $request->validated('to'),
),
),
);
}
}