'Fetch Segment Constant', 'message' => 'You have successfully retrieved the Segment Constant' ]; } /** @var FetchesConstant */ private $fetchesConstant; /** * FetchConstantLogic constructor. * @param FetchesConstant $fetchesConstant */ public function __construct(FetchesConstant $fetchesConstant) { $this->fetchesConstant = $fetchesConstant; } /** * @param Request $request * @return JsonResponse */ public function logic(Request $request) : JsonResponse { $constant = $this->fetchesConstant->execute(['segment_id' => $request->route('id'), 'reference' => $request->route('reference')]); return $this->resourceResponse(new ConstantResource($constant)); } }