From bfacd1e45935d8eaf0e6dd286150c838a049c4ef Mon Sep 17 00:00:00 2001 From: Tomasz Smolarek <59400506+dyfero@users.noreply.github.com> Date: Fri, 22 Mar 2024 14:24:01 +0100 Subject: [PATCH] Update QuestionnaireAnswerService.php (#53) --- src/Services/QuestionnaireAnswerService.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Services/QuestionnaireAnswerService.php b/src/Services/QuestionnaireAnswerService.php index 6d8f890..0b9b308 100644 --- a/src/Services/QuestionnaireAnswerService.php +++ b/src/Services/QuestionnaireAnswerService.php @@ -72,13 +72,14 @@ public function saveAnswer(QuestionnaireModel $questionnaireModel, array $data, $public = $question && !$question->public_answers ? false : Config::get(EscolaLmsQuestionnaireServiceProvider::CONFIG_KEY . '.new_answers_visible_by_default', false); + $this ->questionAnswerRepository ->create( array_merge( $data, [ - 'visible_on_front' => $public, + 'visible_on_front' => $public ?? false, 'user_id' => $user->getKey(), 'question_id' => $questionId, 'questionnaire_model_id' => $questionnaireModel->getKey(),