Exemplo n.º 1
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     if (Input::has('unfin') && Input::has('cat')) {
         $category = Input::get('cat');
         $questions = QuestionsController::unfinishedQuestions()->where('category', $category)->get();
         return View::make('questions.show')->with(['questions' => $questions]);
     } elseif (Input::has('cat')) {
         $category = Input::get('cat');
         $questions = Question::where('category', $category)->get();
         return View::make('questions.show')->with(['questions' => $questions]);
     } elseif (Input::has('unfin')) {
         $questions = QuestionsController::unfinishedQuestions()->get();
         return View::make('questions.show')->with(['questions' => $questions]);
     } elseif (QuestionsController::percentageAll() < 100) {
         $questions = Question::all();
         return View::make('questions.show')->with(['questions' => $questions]);
     } else {
         return Redirect::action('QuestionsController@index');
     }
 }