<?php
class TestingController extends BaseController {
public function getView($subjectId) {
$subject_test = Subject::where('subject_id', '=', $subjectId)->first();
$arr_json = $subject_test['question'];
$arr_json = json_decode($arr_json, true);
unset($arr_json['correct']);
$arr_json = json_encode($arr_json, 256);
if (!$subject_test) {
Subject::abort(404);
}
return View::make('testing/view', array(
'subject_test' => $subject_test,
'arr_json' => $arr_json
)
);
}
}
{
"id":1,
"text":"Проверка",
"correct":3,
"answers":
[{"id":0,"text":1},
{"id":1,"text":2},
{"id":2,"text":3},
{"id":3,"text":4}]
}
{"id":1,"text":"Проверка","correct":3,"answers":[{"id":0,"text":1},{"id":1,"text":2},{"id":2,"text":3},{"id":3,"text":4}]},{"id":2,"text":"Проверка","correct":3,"answers":[{"id":0,"text":1},{"id":1,"text":2},{"id":2,"text":3},{"id":3,"text":4}]}