public function remove_quiz(Request $request, $score_card_id)
 {
     $sc = ScoreCard::find($score_card_id);
     $sc->delete();
     echo "remove";
     return redirect('/student/' . $request->user_id);
 }
Ejemplo n.º 2
0
});
Route::get('/create_free_response_question', 'QuestionController@create_free_response');
Route::post('/save_free_response_question', 'QuestionController@store_free_response');
Route::get('/create_true_false_question', 'QuestionController@create_true_false');
Route::post('/save_true_false_question', 'QuestionController@store_true_false');
Route::get('/test/answer_free_response/{question_id}', function ($question_id) {
    $question = Question::find($question_id);
    //echo $question;
    return view('scorecard.answer_free_response', ['question' => $question]);
});
Route::post('/test/show_response', function ($answer_question_id) {
    echo "Just testing to see if this link works!";
});
//[DELETE THIS]
Route::get('/test', function () {
    $scoreCard = ScoreCard::find(1);
    // $answers = ScoreCard::find(1)->answer_questions()->get();
    $answers = $scoreCard->answer_questions()->get();
    echo $scoreCard->user->first_name;
    //Get Name
    echo "<br>";
    foreach ($answers as $a) {
        echo $a->id;
        echo "<br>";
    }
    echo "<br>";
    $users = User::all();
    foreach ($users as $u) {
        $s = $u->scoreCards()->get();
        echo "User: ";
        echo $u->first_name;
 public function take_quiz()
 {
     $scoreCard = ScoreCard::find(session("scorecardID"));
     $questionNumber = 1;
     $first_question;
     if ($scoreCard->questions()->count() > 0) {
         $first_question = $scoreCard->load_questions();
     } else {
         $first_question = $scoreCard->get_questions();
     }
     $minutes = Quiz::find($scoreCard->quiz_id)->quiz_time;
     $date = new DateTime();
     $date->add(new DateInterval('PT' . $minutes . 'M'));
     session(['score_card' => $scoreCard, 'date' => $date, 'questionNumber' => $questionNumber]);
     return view('scorecard.take', ['question' => $first_question, 'selected_answers' => $scoreCard->selected_answers($first_question->id), 'date' => $date, 'questionNumber' => $questionNumber]);
 }