/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $events = SemesterEvent::classroom()->count(); if (!$events) { return redirect()->route('students.profile.index')->with('warning', trans('students::profile.classrooms.choose_classroom_expired')); } return $next($request); }
public function index() { $available_classrooms = Classroom::select('classrooms.attendees_limit', 'classrooms.name', 'classrooms.code', 'classrooms.id', 'classrooms.teacher_id', 'classrooms.subject_subject_id', 'classrooms.day', 'classrooms.hour')->join('subject_subjects as subsub', 'subsub.id', '=', 'classrooms.subject_subject_id')->join('student_subjects as stusub', function ($join) { $join->on('stusub.subject_id', '=', 'subsub.id')->where('stusub.student_id', '=', student()->id); })->whereIn('classrooms.gender', [student()->gender, 'b'])->whereHas('students', function ($query) { return $query->havingRaw('COUNT(students.id) < attendees_limit'); })->whereNotIn('subject_subject_id', function ($query) { $query->select('classrooms.subject_subject_id')->from('classrooms')->join('classroom_students as clastud', function ($join) { $join->on('clastud.classroom_id', '=', 'classrooms.id')->where('clastud.student_id', '=', student()->id); }); })->with('teacher', 'subject', 'students')->groupBy('teacher_id', 'subject_subject_id')->get(); //return $available_classrooms; $event = SemesterEvent::classroom()->first(); $chosen_classrooms = Classroom::whereHas('students', function ($query) { $query->where('students.id', student()->id); })->get(); return view('students::classrooms.index', compact('available_classrooms', 'chosen_classrooms', 'event')); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if (student()) { $menu = Menu::make('StudentSidebarMenu', function ($menu) { }); $menu->add('الرئيسية', ['route' => 'students.profile.index'])->data('order', 1)->prepend('<i class="fa fa-home"></i>'); $events = SemesterEvent::classroom()->count(); if ($events) { $menu->add(trans(trans('students::profile.classrooms.choose_sessions_classrooms')), ['route' => 'students.profile.classrooms.index'])->prepend('<i class="fa fa-bell animated infinite swing"></i>')->data('order', 1); } $centers = ExamCenterPeriod::where('start_at', '<', date('Y-m-d H:i:s'))->where('finish_at', '>', date('Y-m-d H:i:s'))->where('semester_id', semester()->id)->count(); if ($centers) { $menu->add(trans(trans('students::profile.exams.choose_exam_center')), ['route' => 'students.profile.centers.index'])->prepend('<i class="fa fa-bell animated infinite swing"></i>')->data('order', 2); } $menu->add(trans('students::profile.subjects.header'), ['route' => 'students.profile.subjects.index'])->data('order', 10)->prepend('<i class="fa fa-briefcase"></i>'); $menu->add(trans('students::profile.sessions.header'), ['route' => 'students.profile.sessions.index'])->data('order', 20)->prepend('<i class="fa fa-video-camera"></i>'); $menu->add(trans('students::profile.tickets.header'), ['route' => 'students.profile.tickets.index'])->data('order', 30)->prepend('<i class="fa fa-comment"></i>'); $menu->add(trans('orders::order.menu'), ['route' => 'orders.index'])->prepend('<i class="fa fa-pencil-square-o"></i>'); $menu->add(trans('الأسئلة الشائعة'), ['route' => 'students.faq.index'])->data('order', 40)->prepend('<i class="fa fa-briefcase"></i>'); } return $next($request); }
public function classrooms($student_id = 0) { $student = Student::find($student_id); $available_classrooms = Classroom::select('classrooms.attendees_limit', 'classrooms.name', 'classrooms.code', 'classrooms.id', 'classrooms.teacher_id', 'classrooms.subject_subject_id', 'classrooms.day', 'classrooms.hour')->join('student_subjects as stusub', function ($join) use($student) { $join->on('stusub.subject_id', '=', 'classrooms.subject_subject_id')->where('stusub.state', '=', 'study')->where('stusub.student_id', '=', $student->id); })->whereIn('classrooms.gender', [$student->gender, 'b'])->whereHas('students', function ($query) use($student) { return $query->havingRaw('COUNT(students.id) < attendees_limit'); })->whereNotIn('subject_subject_id', function ($query) use($student) { $query->select('classrooms.subject_subject_id')->from('classrooms')->join('classroom_students as clastud', function ($join) use($student) { $join->on('clastud.classroom_id', '=', 'classrooms.id')->where('clastud.student_id', '=', $student->id); }); })->with('teacher', 'subject', 'students')->groupBy('classrooms.id')->get(); //return $available_classrooms; $event = SemesterEvent::classroom()->first(); $chosen_classrooms = Classroom::whereHas('students', function ($query) use($student) { $query->where('students.id', $student->id); })->get(); // // dd($student->id); // # code... // $studentcalss = Student::with('classrooms','subjects')->where('id',$student->id)->first(); // // dd($studentcalss); // $subjects = Subject::with('classroom')->Student($student->id)->get(); // // $classrooms = $studentcalss->classrooms->pluck('subject_subject_id' ,'name' )->toArray(); // // dd($subjects); // // $subjects = $studentcalss; // // dd($studentcalss); return view('students::subjects.classroom', compact('available_classrooms', 'chosen_classrooms', 'event', 'subjects', 'student', 'classrooms', 'studentcalss')); }