public function create() { $instructors = DB::table('users')->where('user_role', '2')->lists('user_name', 'user_id'); $course_times = Course_time::lists('course_time_name', 'course_time_id'); $semesters = Semester::lists('semester_name', 'semester_id'); return view('courses.create')->with('instructors', $instructors)->with('semesters', $semesters)->with('course_times', $course_times); }
public static function checkinator() { //dd(Course_time::getCurrentTimeBlock()); $currentBlock = Course_time::getCurrentTimeBlock()->course_time_name; $currentBlockID = Course_time::getCurrentTimeBlock()->course_time_id; echo "We are currently in the " . $currentBlock . " Course block. <br>"; $enrolled = Auth::user()->course_checkin(); echo "You are now able to checkin to course: " . $enrolled->course_name; //return var_dump($enrolled->first()->course_name); }
public function course_checkin() { if (isset(Course_time::getCurrentTimeBlock()->course_time_id)) { $timeBlock = Course_time::getCurrentTimeBlock()->course_time_id; $enrolled = DB::table('courses')->leftJoin('rosters', 'rosters.course_id', '=', 'courses.course_id')->where('rosters.user_id', '=', Auth::user()->user_id)->where('courses.course_time_id', '=', $timeBlock)->first(); return $enrolled; } else { return false; } }