'Retrieved Standard Segment Constant', 'message' => 'You have successfully retrieved a list of Standard Segment Constant' ]; } /** @var CanListStandardSegmentConstants */ private $canListStandardSegmentConstants; /** @var ListsSegmentConstants */ private $listsSegmentConstants; /** * ListStandardSegmentConstantLogic constructor. * @param CanListStandardSegmentConstants $canListStandardSegmentConstants * @param ListsSegmentConstants $listsSegmentConstants */ public function __construct(CanListStandardSegmentConstants $canListStandardSegmentConstants, ListsSegmentConstants $listsSegmentConstants) { $this->canListStandardSegmentConstants = $canListStandardSegmentConstants; $this->listsSegmentConstants = $listsSegmentConstants; } /** * @param Request $request * @return JsonResponse * @throws ErrorException */ public function logic(Request $request) : JsonResponse { try { $this->canListStandardSegmentConstants->passes(); $query = $this->listsSegmentConstants->execute( [ 'segment_id' => 1 ] ); return $this->collectionResponse(SegmentResource::collection($query)); } catch (\Exception $exception){ throw new ErrorException($exception->getMessage(), $exception->getCode()); } } }