diff --git a/app/Http/Controllers/SectionQuestionController.php b/app/Http/Controllers/SectionQuestionController.php index 1dc1b00..2528c4d 100644 --- a/app/Http/Controllers/SectionQuestionController.php +++ b/app/Http/Controllers/SectionQuestionController.php @@ -19,13 +19,11 @@ class SectionQuestionController extends Controller */ public function index($section) { - $question = Section::find($section) - ->questions()->paginate(1); + $questions = Section::find($section) + ->questions() + ->orderBy('number', 'asc')->get(); - return $this->response - ->paginator($question, new QuestionTransformer, ['key' => 'questions']); - - // return QuestionTransformer::collection($questions); + return $this->response->collection($questions, new QuestionTransformer); } /** diff --git a/app/Transformers/QuestionTransformer.php b/app/Transformers/QuestionTransformer.php index 3a21aea..170f58e 100644 --- a/app/Transformers/QuestionTransformer.php +++ b/app/Transformers/QuestionTransformer.php @@ -27,6 +27,7 @@ class QuestionTransformer extends TransformerAbstract 'questionType' => $model->question_type, 'choices' => $model->choices, 'creator' => new UserResource($model->creator), + 'answers' => $model->answers, 'links' => [ 'relatedTo' => route('questions.index') ]