public static function getUsersChat($code) { $user = UserController::getUser(Auth::user()); $sectionCodes = null; if ($user instanceof Teacher) { $sectionCodes = SectionCode::where('teacher_id', new MongoId($user->_id))->where('status', true)->where('code', $code)->first(); } else { if ($user instanceof Student) { $sectionCodes = SectionCode::whereIn('students_id', array(new MongoId($user->_id)))->where('status', true)->where('code', $code)->first(); } } return $sectionCodes; }
public function showEnrollSection() { $sections = SectionCode::whereIn('students_id', array(Auth::id()))->where('status', true)->get(); $pending = PendingEnrollment::where('student_id', Auth::id())->get(); return View::make('student.show_all_enrollment')->with(array('sections' => $sections, 'pending' => $pending)); }