public function store(QuestionFormRequest $request)
 {
     //return $request->all();
     $slug = uniqid();
     $question = new Question(array('question' => $request->get('question'), 'option1' => $request->get('option1'), 'option2' => $request->get('option2'), 'option3' => $request->get('option3'), 'option4' => $request->get('option4'), 'slug' => $slug));
     $question->save();
     return redirect('create')->with('status', 'Your question has been saved! Its unique id is: ' . $slug);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(Question $question)
 {
     $delete = $question->delete();
     if ($delete) {
         return 0;
     } else {
         return 1;
     }
 }
 public function postCreateAQuestion(Request $request)
 {
     $question = new Question();
     $question->user_id = \Auth::user()->id;
     $question->title = $request->title;
     $question->slug = str_slug($request->title, "-");
     $question->save();
     return redirect('/questions');
 }
 /**
  * Sync up the list of tags in the database.
  *
  * @param Article $article
  * @param array   $tags
  */
 private function syncTags(Question $question, array $tags)
 {
     // Create new tags if needed and get ids
     $tagIds = [];
     foreach ($tags as $tag) {
         $tagId = Tag::firstOrCreate(['name' => mb_strtolower($tag, 'UTF-8')])->id;
         $tagIds[] = $tagId;
     }
     // Sync tags based on ids
     $question->tags()->sync($tagIds);
 }
 public function addTraining(Request $request)
 {
     $data = array('name' => htmlentities($request->input('title')), 'description' => htmlentities($request->input('description')), 'image' => $request->input('imagine'), 'areaType' => substr($request->input('arie'), 0, 1), 'area' => htmlentities(substr($request->input('arie'), 1)), 'locuri' => htmlentities($request->input('locuri')), 'ziua' => htmlentities($request->input('ziua')), 'ora' => htmlentities($request->input('ora')));
     $data['intrebari'] = array();
     $idIntrebare = 1;
     $intrebare = htmlentities($request->input('intrebare' . $idIntrebare));
     while (isset($intrebare)) {
         array_push($data['intrebari'], $intrebare);
         $idIntrebare++;
         $intrebare = $request->input('intrebare' . $idIntrebare);
     }
     $rules = array('name' => 'required', 'description' => 'required', 'image' => 'image', 'area' => 'exists:areas,id', 'subarea' => 'exists:subareas,id', 'locuri' => 'numeric|required', 'ziua' => 'required', 'ora' => 'required');
     if ($data['areaType'] == 's') {
         $data['subarea'] = $data['area'];
         $data['area'] = Subarea::where('id', $data['subarea'])->first()->area_id;
     } else {
         $data['subarea'] = "";
     }
     $validator = Validator::make($data, $rules);
     if (!$validator->fails()) {
         $training = new Training();
         $nameOfImage = $this->generateRandomString() . '.jpg';
         Storage::put('images/' . $nameOfImage, $data['image']);
         $training->trainer_id = Auth::user()->id;
         $training->name = $data['name'];
         $training->description = $data['description'];
         $training->image = "images/" . $nameOfImage;
         $training->area_id = $data['area'];
         $training->subarea_id = $data['subarea'];
         $training->locuri = $data['locuri'];
         $training->save();
         $group = new Group();
         $group->trainer_id = Auth::user()->id;
         $group->training_id = $training->id;
         $group->area_id = $training->area_id;
         $group->subarea_id = $training->subarea_id;
         $group->groupOrder = 1;
         $group->data = $data['ziua'];
         $group->ora = $data['ora'];
         $group->save();
         foreach ($data['intrebari'] as $intrebare) {
             $question = new Question();
             $question->training_id = $training->id;
             $question->question = $intrebare;
             $question->posted_by = Auth::user()->id;
             $question->required = 1;
             $question->save();
         }
         return redirect('/trainer');
     } else {
         return $data['areaType'];
     }
 }
 public function testShowQuestion()
 {
     $survey = new Survey(['title' => 'Testing survey']);
     $question = new Question(['body' => 'What is this?', 'kind' => 'voice']);
     $survey->save();
     $question->survey()->associate($survey)->save();
     $response = $this->call('GET', route('question.show', ['id' => $question->id]));
     $savingUrl = route('question.question_response.store', ['question_id' => $question->id], false);
     $absoluteSavingUrl = route('question.question_response.store', ['question_id' => $question->id]);
     $this->assertContains($question->body, $response->getContent());
     $this->assertContains($savingUrl . '?Kind=voice', $response->getContent());
     $this->assertNotContains($absoluteSavingUrl, $response->getContent());
 }
 public function store(Request $request, $idTraj)
 {
     $question = new Question();
     $libQuest = $request->question;
     $question->libQuest = $libQuest;
     $question->trajet()->associate(Trajet::find($idTraj));
     $question->save();
     $trajet = Trajet::find($question->idTraj);
     $data = array("question" => $question->libQuest, "idTraj" => $question->idTraj, "mailCond" => $trajet->user->email, "nomCond" => $trajet->user->prenomMemb);
     Mail::send('recherche.question.email', $data, function ($message) use($trajet, $question) {
         $message->to($trajet->user->email, $trajet->user->prenomMemb)->subject('Vous avez reçu une question !');
     });
     return redirect()->route('detailRecherche', $idTraj);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $json = Storage::get('questions.json');
     $this->command->info($json);
     $questions = json_decode($json, true);
     foreach ($questions['questions'] as $question_keys => $question) {
         $this->command->info("Adding Question: " . $question_keys . "...");
         if ($question["type"] != "true-false") {
             $answers = $question['answers'];
             unset($question['answers']);
         }
         $q = new Question($question);
         $q->save();
         foreach ($question as $question_attribute_name => $question_attribute_value) {
             $this->command->info($question_attribute_name);
         }
         if ($q->type == "true-false") {
             $this->command->info("Adding True/False Question...");
             $answer = $question['answer'];
             $aFalse;
             $aTrue;
             if (Answer::where('text', 'true')->count() >= 1) {
                 $aTrue = Answer::where('text', 'true')->first();
             } else {
                 $aTrue = new Answer(['text' => 'true']);
                 $aTrue->save();
             }
             if (Answer::where('text', 'false')->count() >= 1) {
                 $aFalse = Answer::where('text', 'false')->first();
             } else {
                 $aFalse = new Answer(['text' => 'false']);
                 $aFalse->save();
             }
             $q->answers()->save($aFalse, ['is_correct' => $answer ? 0 : 1]);
             $q->answers()->save($aTrue, ['is_correct' => $answer ? 1 : 0]);
         } else {
             $this->command->info("Adding answers...");
             $answer_ids = array();
             foreach ($answers as $answer_index => $answer) {
                 $this->command->info("Adding " . ($answer_index + 1) . "...");
                 $a = new Answer($answer);
                 $a->save();
                 $q->answers()->save($a, ['is_correct' => $answer['is_correct'] === "false" ? 0 : 1]);
             }
         }
         $this->command->info("");
     }
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     DB::table('questions')->truncate();
     $quiz = new Question();
     $quiz->quiz_id = 1;
     $quiz->user_id = 1;
     $quiz->title = 'Seeded question 1';
     $quiz->save();
     $quiz = new Question();
     $quiz->quiz_id = 1;
     $quiz->user_id = 1;
     $quiz->title = 'Seeded question 2';
     $quiz->save();
     DB::statement('SET FOREIGN_KEY_CHECKS=1;');
 }
Example #10
0
 public function add(Request $request, $code)
 {
     $j = 0;
     $answer = '';
     $answer_corrected = '';
     for ($i = 1; $i <= count($request->input('variants')); $i++) {
         if ($j < count($request->input('answers'))) {
             if ($request->input('answers')[$j] == $i) {
                 $answer = $answer . ';' . "1";
                 $j++;
             } else {
                 $answer = $answer . ';' . "0";
             }
         } else {
             $answer = $answer . ';' . "0";
         }
     }
     $answer[0] = '';
     echo strlen($answer);
     for ($i = 1; $i < strlen($answer); $i++) {
         $answer_corrected = $answer_corrected . $answer[$i];
     }
     echo strlen($answer_corrected);
     $title = $request->input('variants')[0];
     for ($i = 1; $i < count($request->input('variants')); $i++) {
         $title = $title . ';' . $request->input('variants')[$i];
     }
     Question::insert(array('code' => $code, 'title' => $title, 'variants' => '', 'answer' => $answer_corrected, 'points' => $request->input('points')));
 }
Example #11
0
 public function store(QuestRequest $request)
 {
     $quest = Question::create($request->all());
     $quest->section()->attach($request->input('section'));
     flash()->success('Twoje zapytanie zostało wysłane poprawnie, oczekuj odpowiedzi na swojej skrzynce pocztowej. Zazwyczaj trwa to do 24h, pozdrawiamy, ekipa PLERP!');
     return redirect('/');
 }
Example #12
0
 function questions()
 {
     $faker = Faker::create();
     foreach (range(0, 10) as $i) {
         Question::create(['body' => $faker->paragraph]);
     }
 }
Example #13
0
 public function index()
 {
     $questions = Question::all();
     $tpl['user'] = \Auth::user();
     $tpl['questions'] = $questions;
     return view('home', $tpl);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     for ($i = 0; $i < 100; $i++) {
         $question = \App\Question::create(['question' => $faker->text(300), 'option_1' => $faker->text(100), 'option_2' => $faker->text(100), 'option_3' => $faker->text(100), 'option_4' => $faker->text(100), 'answer' => $faker->numberBetween(1, 4), 'user_create' => $faker->numberBetween(1, 10)]);
     }
 }
 public function testStoreResponse()
 {
     $survey = new Survey(['title' => 'Testing survey']);
     $questionOne = new Question(['body' => 'What is this?', 'kind' => 'voice']);
     $questionTwo = new Question(['body' => 'What is that?', 'kind' => 'voice']);
     $survey->save();
     $questionOne->survey()->associate($survey)->save();
     $questionTwo->survey()->associate($survey)->save();
     $responseForQuestion = ['RecordingUrl' => '//somefake.mp3', 'CallSid' => '7h1515un1qu3', 'Kind' => 'voice'];
     $firstResponse = $this->call('POST', route('question.question_response.store', ['question_id' => $questionOne->id]), $responseForQuestion);
     $routeToNextQuestion = route('question.show', ['id' => $questionTwo->id], false);
     $routeToNextQuestionAbsolute = route('question.show', ['id' => $questionTwo->id], true);
     $this->assertContains($routeToNextQuestion, $firstResponse->getContent());
     $secondResponse = $this->call('POST', route('question.question_response.store', ['question_id' => $questionTwo->id]), $responseForQuestion);
     $this->assertNotContains('Redirect', $secondResponse->getContent());
 }
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     //
     parent::boot($router);
     $router->bind('articles', function ($id) {
         $article = Article::findOrFail($id);
         // If the owner return all articles else return only published.
         if (Auth::user() && $article->user_id === Auth::user()->id) {
             $articles = Article::findOrFail($id);
         } else {
             $articles = Article::published()->findOrFail($id);
         }
         return $articles;
     });
     $router->bind('questions', function ($id) {
         return Question::findOrFail($id);
     });
     $router->bind('answers', function ($id) {
         return Answer::findOrFail($id);
     });
     $router->bind('tags', function ($name) {
         return Tag::where('name', $name)->firstOrFail();
     });
     $router->bind('users', function ($id) {
         return User::findOrFail($id);
     });
 }
Example #17
0
 public function add(Request $request, $code)
 {
     //были изменения
     $variants = $request->input('variants')[0];
     $answer = '';
     $flag = false;
     for ($i = 1; $i < count($request->input('variants')); $i++) {
         $variants = $variants . ';' . $request->input('variants')[$i];
     }
     $title = $request->input('title')[0];
     for ($i = 1; $i < count($request->input('title')); $i++) {
         $title = $title . ';' . $request->input('title')[$i];
     }
     // $j = 0;
     // while ($flag != true && $j<count($request->input('answer'))){
     // if (isset($request->input('answer')[$j])){
     // $answer = $j + 1;
     // $j++;
     // break;
     // }
     // $j++;
     // }
     $answer = $request->input('answer')[0];
     for ($i = 1; $i < count($request->input('answer')); $i++) {
         $answer = $answer . ';' . $request->input('answer')[$i];
     }
     Question::insert(array('code' => $code, 'title' => $title, 'variants' => $variants, 'answer' => $answer, 'points' => $request->input('points')));
 }
 /**
  * GET test question response index
  *
  * @return void
  */
 public function testQuestionSurveyResults()
 {
     $responseDataOne = ['kind' => 'voice', 'response' => '//faketyfake.mp3', 'call_sid' => '4l505up3run1qu3'];
     $responseDataTwo = ['kind' => 'voice', 'response' => '//somefakesound.mp3', 'call_sid' => '5up3run1qu3'];
     $question = new Question(['body' => 'What is this?', 'kind' => 'voice']);
     $question->survey()->associate($this->firstSurvey);
     $question->save();
     $question->responses()->createMany([$responseDataOne, $responseDataTwo]);
     $question->push();
     $response = $this->call('GET', route('survey.results', ['id' => $this->firstSurvey->id]));
     $this->assertEquals($response->original['responses']->count(), 2);
     $actualResponseOne = $response->original['responses']->get(0)->toArray()[0];
     $actualResponseTwo = $response->original['responses']->get(1)->toArray()[0];
     $this->assertArraySubset($responseDataOne, $actualResponseOne);
     $this->assertArraySubset($responseDataTwo, $actualResponseTwo);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $student = Auth::user();
     $course_id = $request["course_id"];
     $questions = Question::where('course_id', '=', $course_id)->get();
     if (count($questions) <= 0) {
         Flash::error('There was a problem processing your request.');
         return redirect()->route('registration.index');
     }
     $question_count = 0;
     $passed_count = 0;
     foreach ($questions as $que) {
         $question_count = $question_count + 1;
         $keyword_found = 0;
         $answer_array = explode(',', $que->answers);
         $students_reply_array = explode(' ', $request[$que->id]);
         $students_reply = $request[$que->id];
         foreach ($answer_array as $keyword) {
             if (strpos($students_reply, $keyword) !== false) {
                 $keyword_found = $keyword_found + 1;
             }
         }
         if ($keyword_found == count($answer_array)) {
             $passed_count = $passed_count + 1;
         }
     }
     $percent = $passed_count / $question_count * 100;
     Exam::create(['course_id' => $course_id, 'student_id' => $student->id, 'score_percentage' => $percent]);
     Flash::success('Answer sheet submitted successfully.');
     return redirect()->route('registration.index');
 }
 public function storeTranscription($surveyId, $questionId, Request $request)
 {
     $callSid = $request->input('CallSid');
     $question = Question::find($questionId);
     $questionResponse = $question->responses()->where('session_sid', $callSid)->firstOrFail();
     $questionResponse->responseTranscription()->create(['transcription' => $this->_transcriptionMessageIfCompleted($request)]);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $user = JWTAuth::parseToken()->authenticate();
     $user_id = $user->id;
     $question = Question::find($request['question_id']);
     if (!$question) {
         return response()->json(['success' => false, 'message' => "invalid question id."]);
     }
     $question_owner = $question->owner();
     //        dd($question_owner);
     if ($user->points == 0) {
         return response()->json(['success' => false, 'message' => "Please recharge"]);
     }
     //validate data
     $validator = Validator::make($request->all(), array('text' => 'required', 'question_id' => 'required'));
     if ($validator->fails()) {
         return $validator->errors()->all();
     } else {
         $previousAnswer = Answer::where('question_id', $request['question_id'])->where('user_id', $user_id)->get();
         if (count($previousAnswer) > 0) {
             return response()->json(['success' => false, 'message' => "You've already answered this question before.", 'answer' => $request['text']]);
         } else {
             $follower_user = $user->id . "_" . $question_owner->id;
             Answer::create(['text' => $request['text'], 'user_id' => $user_id, 'question_id' => $request['question_id'], 'follower_user' => $follower_user]);
             try {
                 $user->addFollowing($question_owner);
                 $user->points = $user->points - 1;
                 $user->save();
             } catch (Exception $e) {
             }
         }
         return response()->json(['success' => true, 'message' => "Answer Added Successfully", 'answer' => $request['text']]);
     }
 }
 public function store($questionId)
 {
     $answer = Request::user()->answers()->create(['answer' => Request::input('answer')]);
     $question = Question::find($questionId);
     $question->answers()->save($answer);
     return redirect()->back();
 }
Example #23
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int $id
  * @return Response
  */
 public function update($id, Request $request)
 {
     $question = Question::findOrFail($id);
     $question->state_id = $request->get('state_id');
     $question->save();
     return redirect(route('admin.questions.index'));
 }
Example #24
0
 /**
  * Setting question to not answered, if question wasnt answered.
  *
  * @return Response
  */
 public function setNotanswered($id)
 {
     $question = \App\Question::find($id);
     $question->status = "notanswered";
     $question->save();
     return redirect()->to('moderator');
 }
Example #25
0
 public function add(Request $request, $code)
 {
     $variants = '';
     $arr_answers = [];
     $answers = explode('|', $request->input('variants-1')[1])[0];
     for ($i = 0; $i < $request->input('number_of_blocks'); $i++) {
         for ($j = 1; $j < count($request->input('variants-' . ($i + 1))); $j++) {
             if ($i == 0 && $j == 1) {
                 $variants = explode('|', $request->input('variants-' . ($i + 1))[$j])[0];
             }
             if ($j == 1 && $i != 0) {
                 $variants = $variants . '<>' . explode('|', $request->input('variants-' . ($i + 1))[$j])[0];
             }
             if ($j != 1) {
                 $variants = $variants . ';' . $request->input('variants-' . ($i + 1))[$j];
             }
         }
         if ($i != 0) {
             $answers = $answers . ';' . explode('|', $request->input('variants-' . ($i + 1))[1])[0];
         }
         $arr_answers[$i] = $request->input('variants-' . ($i + 1))[1];
         print_r($arr_answers);
     }
     $variants = $variants . '%' . $request->input('variants-1')[0];
     for ($i = 2; $i <= $request->input('number_of_blocks'); $i++) {
         $variants = $variants . ';' . $request->input('variants-' . $i)[0];
     }
     $wet_text = $request->input('title');
     for ($i = 0; $i < count($arr_answers); $i++) {
         $wet_text = preg_replace('~' . explode('|', $arr_answers[$i])[0] . '\\|' . explode('|', $arr_answers[$i])[1] . '~', '<>', $wet_text);
     }
     Question::insert(array('code' => $code, 'title' => $wet_text, 'variants' => $variants, 'answer' => $answers, 'points' => $request->input('points')));
 }
Example #26
0
 public function getQuesitions(Request $request)
 {
     $type = $request->get('type');
     switch ($type) {
         case 0:
             $questions = Question::take(10)->get();
             break;
         case 1:
             $questions = Question::orderBy('total_answer', 'desc')->take(10)->get();
             break;
         case 2:
             $questions = Question::where('issolved', 0)->take(10)->get();
             break;
         default:
             $questions = Question::where('issolved', 1)->take(10)->get();
             break;
     }
     if ($questions) {
         foreach ($questions as &$question) {
             $question['time'] = $question->created_at->diffForHumans();
             $question['username'] = $question->user->name;
         }
         $this->setResult($questions);
         $this->succeed(true);
     } else {
         $this->setResult('questions表获取记录失败!');
         $this->fail(true);
     }
 }
Example #27
0
 /**
  * @param $questionerId
  */
 public static function deleteQuestions($questionerId)
 {
     $question = Question::where('questioner_id', '=', $questionerId)->get();
     foreach ($question as $q) {
         $q->delete();
     }
 }
Example #28
0
 public function proposeSolution()
 {
     $questionId = Request::get('questionId');
     $question = Question::find($questionId);
     $answers = $question->answers()->get()->toArray();
     // Prepare array of proposed answers
     $proposedSolution = [];
     if ($question->question_type == 'one_variant') {
         $proposedSolution[] = (int) Request::get('chosenAnswer');
     } else {
         $proposedSolution = Request::get('chosenAnswers');
     }
     // Prepare array of correct answers
     $correctSolution = [];
     foreach ($answers as $answer) {
         if ($answer['is_correct']) {
             $correctSolution[] = $answer['id'];
         }
     }
     $proposedSolutionResult = $proposedSolution == $correctSolution;
     // pass to response detailed results on proposed solution
     $proposedSolutionWithDetailedResult = [];
     foreach ($proposedSolution as $answerId) {
         foreach ($answers as $answer) {
             if ($answer['id'] == $answerId) {
                 $is_correct = $answer['is_correct'];
             }
         }
         $proposedSolutionWithDetailedResult[$answerId] = $is_correct;
     }
     if (\Auth::user()) {
         \Auth::user()->replies()->updateOrCreate(['question_id' => $questionId], ['is_correct' => $proposedSolutionResult]);
     }
     return response()->json(['correctSolution' => $correctSolution, 'proposedSolutionWithDetailedResult' => $proposedSolutionWithDetailedResult, 'proposedSolutionResult' => $proposedSolutionResult]);
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $year = date('Y');
     $month = date('n');
     $day = date('j');
     $question = Question::where('year', $year)->where('month', $month)->where('day', $day)->first();
     if (count($question)) {
         $leagues = League::where('year', $question->leagueYear())->where('month', $question->leagueMonth())->get();
         foreach ($leagues as $key => $league) {
             $players = json_decode($league->users);
             foreach ($players as $key => $player) {
                 $user = User::find($player);
                 if ($user->deadline_reminder && $user->active) {
                     $answers = Answer::where('question_id', $question->id)->where('user_id', $user->id)->first();
                     if (!count($answers)) {
                         Mail::send('emails.deadlinereminder', [], function ($message) use($user) {
                             $message->from('*****@*****.**', 'Liga Quiz Portugal');
                             $message->to($user->email, $user->fullName())->subject('Quiz ainda não respondido');
                         });
                     }
                 }
             }
         }
     }
 }
 /**
  * Store a newly created resource in storage.
  * Assumption: All quesitons are multi-value,
  *      Questions are in the database already
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $scoreCard = session('score_card');
     if (Question::find($request->qID)->type == 'free-response') {
         $free_response;
         $question = Question::find($request->qID);
         if ($scoreCard->responses()->where('question_id', $question->id)->count() >= 1) {
             $free_response_id = $scoreCard->responses()->where('question_id', $question->id)->first()->id;
             $free_response = FreeResponse::find($free_response_id);
         } else {
             $free_response = new FreeResponse();
         }
         $free_response->question_id = $request->qID;
         $free_response->response = $request->response;
         $free_response->score_card_id = $scoreCard->id;
         $free_response->save();
         $scoreCard->responses()->save($free_response);
     } else {
         $answers = $scoreCard->answer_questions()->wherePivot('question_id', '=', $request->qID)->get();
         $student_response = $scoreCard->questions()->where('questions.id', '=', $request->qID)->get();
         $studentAnswers = array();
         foreach (Question::find($request->qID)->answers()->get() as $a) {
             if ($request->has('cb' . $a->pivot->id)) {
                 array_push($studentAnswers, $a->pivot->id);
             }
         }
         if (count($studentAnswers) > 0) {
             // echo "detaching...<br>";
             $scoreCard->questions()->detach($request->qID);
             foreach ($studentAnswers as $a) {
                 // echo "attaching...".$a."<br>";
                 $scoreCard->questions()->attach($request->qID, array('answer_question_id' => $a));
             }
         } else {
             $scoreCard->questions()->detach($request->qID);
             $scoreCard->questions()->attach($request->qID, array('answer_question_id' => null));
         }
     }
     if ($request->has('next')) {
         $question = $scoreCard->next();
         if ($question != null) {
             $questionNumber = $request->session()->get('questionNumber');
             $questionNumber++;
             $request->session()->put('questionNumber', $questionNumber);
             return $this->goto_qustion($question, $scoreCard);
         } else {
             return redirect('/finished_quiz');
         }
     }
     if ($request->has('prev')) {
         $question = $scoreCard->prev();
         if ($question != null) {
             $questionNumber = $request->session()->get('questionNumber');
             $questionNumber--;
             $request->session()->put('questionNumber', $questionNumber);
             return $this->goto_qustion($question, $scoreCard);
         }
     }
 }