'Retrieved Admin Workflow First Question', 'message' => 'You have successfully retrieved a Admin Workflow First Question' ]; } /** @var CanFetchQuestion */ private $canFetchQuestion; /** @var FetchFirstQuestionV1AdminWFProcessor */ private $fetchFirstQuestionQAProcessor; /** * FetchQuestionV1AdminWFLogic constructor. * @param CanFetchQuestion $canFetchQuestion * @param FetchFirstQuestionV1AdminWFProcessor $fetchFirstQuestionQAProcessor */ public function __construct(CanFetchQuestion $canFetchQuestion, FetchFirstQuestionV1AdminWFProcessor $fetchFirstQuestionQAProcessor) { $this->canFetchQuestion = $canFetchQuestion; $this->fetchFirstQuestionQAProcessor = $fetchFirstQuestionQAProcessor; } /** * @param Request $request * @return JsonResponse * @throws ErrorException */ public function logic(Request $request) : JsonResponse { $this->canFetchQuestion->passes(); $userId = Auth::user()->id; $query = $this->fetchFirstQuestionQAProcessor->execute($request); return $this->resourceResponse(new QuestionResource($query, $userId)); } }