Example #1
0
 public function create()
 {
     $classrooms = Classroom::inCurrentSemester()->pluck('code', 'id')->toArray();
     $subjects = Subject::isCurrent()->lists('name', 'id')->toArray();
     $intervals = ClassroomInterval::inCurrentSemester()->pluck('title', 'id')->toArray();
     $teachers = Teacher::isActive()->pluck('name', 'id')->toArray();
     return view('classrooms::sessions.create', compact('classrooms', 'subjects', 'teachers', 'intervals'));
 }
Example #2
0
 public function index($subject_id = 0)
 {
     $subject = Subject::findOrFail($subject_id);
     $teachers = Teacher::whereHas('subjects', function ($q) use($subject) {
         $q->where('subject_subjects.id', $subject->id);
     })->get();
     $active_teachers = Teacher::isActive()->whereNotIn('teachers.id', $teachers->pluck('id')->toArray())->pluck('name', 'id')->toArray();
     return view('subject::teachers.index', compact('subject', 'teachers', 'active_teachers'));
 }
Example #3
0
 public function store(CreateGuideRequest $request)
 {
     $input = $request->all();
     $guide = new TeacherGuide();
     $guide = $guide->fill($input);
     $guide->save();
     $teachers = Teacher::isActive()->get();
     $email = trans('teachers::guides.email_template', ['name' => $guide->name, 'url' => asset($guide->file->url())]);
     $this->dispatch(new SendTeachersMessage($teachers, $email, false, user()->id));
     if (isset($input['submit']) and $input['submit'] == 'save') {
         return redirect()->route('teachers.guides.create');
     }
     return redirect()->route('teachers.guides.index');
 }
 public function index(Request $request)
 {
     $classrooms = Classroom::with('subject', 'teacher')->withCount('students')->inCurrentSemester();
     // $input['username'] = (!empty($input['code']) and substr($input['code'],0,3)!='e20' and strlen($input['code'])>=5)
     //                      ? strtoupper(substr($input['code'], -5,5))
     //                      : (!empty($input['code']) ? $input['code'] : null);
     //           if(empty($input['username'])) {
     //             unset($input['username']);
     //           }
     // unset($input['code']);
     if (substr(request('username'), 0, 3) != 'e20' and strlen(request('username')) >= 5) {
         $username = strtoupper(substr(request('username'), -5, 5));
     } else {
         $username = request('username');
     }
     // dd($username);
     if (!empty($username)) {
         $student_classroom = Student::with('classrooms')->where('username', $username)->first();
         $filter_classroom = $student_classroom->classrooms->pluck('id')->toArray();
         $classrooms->whereIn('id', $filter_classroom);
     }
     $array_filters = ['day', 'gender'];
     $text_filters = ['code'];
     foreach ($array_filters as $filter) {
         if (request()->has($filter)) {
             $classrooms->whereIn($filter, request($filter));
         }
     }
     if (request()->has('teacher_id')) {
         $classrooms->where('teacher_id', request('teacher_id'));
     }
     if (request()->has('subject_subject_id')) {
         $classrooms->where('subject_subject_id', request('subject_subject_id'));
     }
     foreach ($text_filters as $filter) {
         if (request()->has($filter)) {
             $classrooms->where($filter, request($filter));
         }
     }
     if (request()->ajax()) {
         return $classrooms->get();
     }
     $teachers = Teacher::isActive()->pluck('name', 'id')->toArray();
     $subjects = Subject::isCurrent()->lists('name', 'id');
     $has_search = count(request()->except('page', 'per_page'));
     $classrooms = $classrooms->orderBy('day', 'ASC')->orderBy('hour', 'ASC')->paginate(20);
     $genders = $this->genders;
     $days = $this->days;
     return view('classrooms::classrooms.index', compact('classrooms', "days", "genders", 'has_search', 'teachers', 'subjects'));
 }
Example #5
0
 public function teachertable(Request $request)
 {
     $sessions = ClassroomSession::with(['teacher', 'classroom', 'subject']);
     if ($request->has('teacher_id')) {
         $sessions->whereHas('teacher', function ($q) use($request) {
             $q->where('id', $request->input('teacher_id'));
         });
     }
     $per_page = request('per_page') ? request('per_page') : 30;
     $sessions = $sessions->paginate($per_page);
     $sessions = $sessions->appends($request->except("page"));
     $teachers = Teacher::isActive()->pluck('name', 'id')->toArray();
     return view('classrooms::reports.teachertable', compact('sessions', 'teachers'));
 }