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

883 B
Raw Blame
<?php

namespace HiEvents\Http\Actions\EventOccurrences;

use HiEvents\DomainObjects\EventDomainObject;
use HiEvents\Http\Actions\BaseAction;
use HiEvents\Resources\EventOccurrence\ProductOccurrenceVisibilityResource;
use HiEvents\Services\Application\Handlers\EventOccurrence\GetProductVisibilityHandler;
use Illuminate\Http\JsonResponse;

class GetProductVisibilityAction extends BaseAction
{
    public function __construct(
        private readonly GetProductVisibilityHandler $handler,
    ) {}

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

        $visibility = $this->handler->handle($eventId, $occurrenceId);

        return $this->resourceResponse(
            resource: ProductOccurrenceVisibilityResource::class,
            data: $visibility,
        );
    }
}