コード例 #1
0
 /**
  * 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'));
 }
コード例 #2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id, Request $request)
 {
     $class = \Session('class');
     $subject = \Session('subject');
     $question = Question::find($id);
     if ($request->get('agree') == 1) {
         $question->delete();
         return redirect()->to("questions?class={$class}&subject={$subject}")->with('message', '<p class="alert alert-success">Question Deleted</p>');
     }
     return redirect('questions');
 }
コード例 #3
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy(Request $request, $id, $subjectId, $questionId)
 {
     $question = Question::find($questionId);
     if ($request->get('agree') == 1) {
         $question->delete();
         return redirect()->route("classes.subjects.questions.index", [$id, $subjectId])->with('message', '<p class="alert alert-success">Question Deleted</p>');
     }
     return redirect()->route("classes.subjects.questions.index", [$id, $subjectId]);
 }