fetchesQuestion = $fetchesQuestion; } public function execute(Request $request){ try { $setId = $request->route('set_id'); if($setId === '0'){ $set = QAQuestionnaireSet::where('group', 'workflow')->latest('id')->first(); $setId = $set->id; } $query = $this->fetchesQuestion->execute(['questionnaire_set_id' => $setId]); return $query; } catch (\Exception $exception){ throw new ErrorException($exception->getMessage(), $exception->getCode()); } } }