question->createQuestion($request->validated()); return back()->with('success', 'Question created successfully.'); } /** * Update the specified question */ public function update(ExamQuestionRequest $request, string $id) { $this->question->updateQuestion($id, $request->all()); return back()->with('success', 'Question updated successfully.'); } /** * Remove the specified question */ public function destroy(string $id) { $this->question->deleteQuestion($id); return back()->with('success', 'Question deleted successfully.'); } /** * Reorder questions */ public function reorder(Request $request) { $this->question->updateSortValues('exam_questions', $request->sortedData); return back()->with('success', 'Questions reordered successfully.'); } /** * Duplicate a question */ public function duplicate(ExamQuestion $question) { $this->question->duplicateQuestion($question); return back()->with('success', 'Question duplicated successfully.'); } }