public function postGuardar()
 {
     $bandera = false;
     $id = Input::get('idQues');
     $ans = Input::get('res');
     $answers = Answer::all();
     $question = Question::find($id);
     $cantidad = Question::count();
     foreach ($answers as $a) {
         if ($a->id_question == $id) {
             $bandera = true;
             $answer = $a;
             break;
         }
     }
     if (!$bandera) {
         $answer = new Answer();
         $answer->id_question = $id;
         $ids = Auth::id();
         $student = Student::where('id_user', '=', $ids)->get()->first();
         $answer->id_student = $student->id;
         $answer->answer = $ans;
         $answer->result = QuestionsController::verifyAnswer($question, $ans);
         $answer->save();
     } else {
         $answer->result = QuestionsController::verifyAnswer($question, $ans);
         $answer->answer = $ans;
         $answer->save();
     }
     if ($cantidad == $id) {
         return Redirect::to('questions/exam?endTest=yes');
         //"holi ".$id." ".$ans;
     } else {
         if ($cantidad > $id) {
             return Redirect::to('questions/exam?numberQIn=' . ++$id);
         }
     }
 }
예제 #2
0
 public function index()
 {
     $answers = Answer::all();
     // return View::make('admin.index', compact('answers'));
 }
예제 #3
0
 public function resultsonly()
 {
     $answers = Answer::all();
     $questions = Question::all();
     return View::make('resultsonly', array('answers' => $answers, 'questions' => $questions));
 }
예제 #4
0
 /**
  * Display the specified resource.
  * GET /answers/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     return Answer::all();
 }
예제 #5
0
 public function getIndex()
 {
     $answers = Answer::all();
     // return View::make('audiopedia.index', compact('answers'));
 }