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\Questions;
use HiEvents\DomainObjects\EventDomainObject;
use HiEvents\DomainObjects\ProductDomainObject;
use HiEvents\DomainObjects\ProductPriceDomainObject;
use HiEvents\Http\Actions\BaseAction;
use HiEvents\Repository\Eloquent\Value\Relationship;
use HiEvents\Repository\Interfaces\QuestionRepositoryInterface;
use HiEvents\Resources\Question\QuestionResource;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class GetQuestionsAction extends BaseAction
{
private QuestionRepositoryInterface $questionRepository;
public function __construct(QuestionRepositoryInterface $questionRepository)
{
$this->questionRepository = $questionRepository;
}
public function __invoke(Request $request, int $eventId): JsonResponse
{
$this->isActionAuthorized($eventId, EventDomainObject::class);
$questions = $this->questionRepository
->loadRelation(
new Relationship(ProductDomainObject::class, [
new Relationship(ProductPriceDomainObject::class),
])
)
->findByEventId($eventId);
return $this->resourceResponse(QuestionResource::class, $questions);
}
}