예제 #1
0
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     if ($this->adminAuth()) {
         $categories = Category::take(10)->get();
         $users = User::where('type', 'teacher')->take(5)->get();
         $courses = Course::take(10)->get();
         return view('adminHome', compact('courses', 'users', 'categories'));
     } elseif ($this->teacherAuth()) {
         $courses = Course::where('user_id', Auth::User()->id)->take(10)->get();
         return view('teacherHome', compact('courses'));
     } elseif ($this->studentAuth()) {
         $courseStudents = CourseStudent::where('user_id', Auth::User()->id)->take(10)->get();
         return view('studentHome', compact('courseStudents'));
     }
     //return view('home');
 }
예제 #2
0
 public function getStudents($courseId)
 {
     return CourseStudent::where("course_id", $courseId)->get();
 }
예제 #3
0
 public function clearGp($gpId)
 {
     $students = CourseStudent::where("gp_id", $gpId);
     return $students->delete();
 }