'Set 1', 'description' => 'Customer Support Satisfaction Survey', 'group' => 'feedback', 'version' => 2 ], [ 'name' => 'Set 2', 'description' => 'First Order Experience Feedback', 'group' => 'feedback', 'version' => 2 ], [ 'name' => 'Set 3', 'description' => 'Sales Inquiry Experience', 'group' => 'feedback', 'version' => 2 ], ]; foreach ($questionnaireSets as $set) { $questionnaireSet = QAQuestionnaireSet::create([ 'name' => $set['name'], 'description' => $set['description'], 'group' => $set['group'], 'version' => $set['version'], ]); $questions = []; switch ($set['name']) { case 'Set 1': $questions = [ [ 'question_number' => 10, 'question_text' => 'How satisfied are you with the time it took to receive a response?', 'question_type' => QAType::MULTIPLE_CHOICES, 'is_start' => true, 'is_end' => false, ], [ 'question_number' => 20, 'question_text' => 'Was your issue resolved during this interaction?', 'question_type' => QAType::MULTIPLE_CHOICES, 'is_start' => false, 'is_end' => false, ], [ 'question_number' => 30, 'question_text' => 'How clear and understandable was the communication from the support team?', 'question_type' => QAType::MULTIPLE_CHOICES, 'is_start' => false, 'is_end' => true, ] ]; break; case 'Set 2': $questions = [ [ 'question_number' => 10, 'question_text' => 'Did you find what you were looking for without any issues?', 'question_type' => QAType::MULTIPLE_CHOICES, 'is_start' => true, 'is_end' => false, ], [ 'question_number' => 20, 'question_text' => 'Did the service meet your expectations?', 'question_type' => QAType::MULTIPLE_CHOICES, 'is_start' => false, 'is_end' => false, ], [ 'question_number' => 30, 'question_text' => 'How satisfied are you with the delivery time?', 'question_type' => QAType::MULTIPLE_CHOICES, 'is_start' => false, 'is_end' => true, ] ]; break; case 'Set 3': $questions = [ [ 'question_number' => 10, 'question_text' => 'How quickly did our sales team respond to your inquiry?', 'question_type' => QAType::MULTIPLE_CHOICES, 'is_start' => true, 'is_end' => false, ], [ 'question_number' => 20, 'question_text' => 'Was the information provided by our sales team clear and easy to understand?', 'question_type' => QAType::MULTIPLE_CHOICES, 'is_start' => false, 'is_end' => false, ], [ 'question_number' => 30, 'question_text' => 'After interacting with our sales team, how likely are you to use our service?', 'question_type' => QAType::MULTIPLE_CHOICES, 'is_start' => false, 'is_end' => true, ] ]; break; } foreach ($questions as $key => $questionData) { $question = new QAQuestions; $question->question_number = $questionData['question_number']; $question->question_text = $questionData['question_text']; $question->question_type = $questionData['question_type']; $question->questionnaire_set_id = $questionnaireSet->id; if (isset($questionData['next_nested_question'])) { $question->next_nested_question = $questionData['next_nested_question']; } if (isset($questionData['next_main_question'])) { $question->next_main_question = $questionData['next_main_question']; } $question->is_start = $questionData['is_start']; $question->is_end = $questionData['is_end']; if (isset($questionData['end_text'])) { $question->end_text = $questionData['end_text']; } $question->order = $key + 1; $question->save(); } } } }