/** * Display a listing of the resource. * * @return Response */ public function index() { $user = User::find(Auth::id()); if ($user->isExaminer()) { $quizzes = Quiz::where('user_id', $user->id)->latest()->get(); } else { if ($user->isExaminee()) { $quizzes = $user->availableQuizzes()->latest()->get(); } else { $quizzes = Quiz::latest()->get(); } } return view('quiz.index', compact('quizzes', 'user')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $quizzes = Quiz::latest()->published()->get(); return view('quizzes.index', compact('quizzes')); }