/** * Display a listing of the resource. * * @return Response */ public function index($classe_id, $subject_id) { $user = \Auth::user(); $term = 'First Term'; $count = 1; $questions = Question::where('classe_id', $classe_id)->where('subject_id', $subject_id)->get(); return view('admin.questions.index', compact('questions', 'count', 'subject_id', 'classe_id', 'term', 'user')); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($classe_id, $subject_id) { $user = \Auth::user(); $term = 'First Term'; $count = 1; $questions = Question::where('classe_id', $classe_id)->where('subject_id', $subject_id)->orderBy(\DB::raw('RAND()'))->get(); $totals = Question::where('classe_id', $classe_id)->where('subject_id', $subject_id)->get(); return view('exams.show', compact('questions', 'count', 'subject_id', 'classe_id', 'term', 'totals', 'user')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $user = \Auth::user(); $term = 'First Term'; if ($_GET['class']) { $this->class = $_GET['class']; $this->subject = $_GET['subject']; \Session::put('class', $_GET['class']); \Session::put('subject', $_GET['subject']); } $classe_id = Classe::where('name', $this->class)->first()->id; $subject_id = Subject::where('name', $this->subject)->first()->id; $count = 1; $questions = Question::where('classe_id', $classe_id)->where('subject_id', $subject_id)->get(); return view('admin.questions.index', compact('questions', 'count', 'subject_id', 'classe_id', 'term', 'user')); }