/** * Show the form for creating a new resource. * @return Response */ public function create() { $students = QuranTimeExtend::with('student', 'semester', 'subject')->where('semester_id', semester()->id)->paginate(20); $subjects = Subject::where('is_quran', 1)->pluck('name', 'id')->toArray(); //$name = $students->$student; return view('quran::time_extend.create', compact('students', 'subjects')); }
public function edit($user_id) { $subjects = Subject::where('is_quran', 1)->pluck('name', 'id')->toArray(); $students = Student::isStudying()->pluck('name', 'id')->toArray(); $user = User::with('quran_subjects', 'quran_students')->findOrFail($user_id); return view('quran::evaluators.edit', compact('user', 'subjects', 'students')); }
public function lesson_report(Request $req, Lesson $UserModel, $subid) { $lessons = $UserModel::with('elements')->where('subject_subject_id', $subid)->paginate(20); $subjects = Subject::where('id', $subid)->first(); if ($req->has('title')) { $lessons = Lesson::where('subject_subject_id', $subid)->where('name', $req->input('title'))->paginate(20); } return view('subject::reports.lesson_report', compact('lessons', 'subid', 'subjects')); }
public function create() { $elements = EvaluationElement::paginate(20); // $years = Year::leftJoin('academystructure_terms as acaterm', 'acaterm.year_id', '=', 'ay.id') // ->leftJoin('academystructure_departments as acadep', 'acadep.term_id', '=', 'acaterm.id') // ->Leftjoin('students as s', 's.academystructure_department_id', '=', 'acadep.id') // ->groupBy('ay.id') // ->from('academystructure_years as ay') // ->havingRaw('COUNT(s.id)>0') // ->pluck('ay.name', 'ay.id') // ->toArray(); $subjects = Subject::where('is_quran', 1)->pluck('name', 'id')->toArray(); // dd($subjects); return view('quran::elements.create', compact('elements', 'subjects')); }
public function classrooms(Request $request, $export = 0) { $students = Student::isStudying()->with(['subjects' => function ($q) use($request) { $q->wherePivot('state', 'study'); $q->where('semester_id', semester()->id); if ($request->has('subject_subject_id')) { $q->where('subject_subjects.id', $request->input('subject_subject_id')); } }, 'classrooms' => function ($q) { $q->where('classrooms.semester_id', semester()->id); }]); if ($request->has('subject_subject_id')) { $students->whereHas('subjects', function ($q) use($request) { $q->where('subject_subjects.id', $request->input('subject_subject_id'))->where('semester_id', semester()->id)->where('state', 'study'); }); } if ($request->has('classroom_select_id')) { $selected = request('classroom_select_id'); $subject_id = request('subject_subject_id'); $students = $students->whereHas('classrooms', function ($query) use($subject_id) { $query->where('subject_subject_id', $subject_id); }, $selected); } if (request('spec_id')) { $spec_id = request('spec_id'); $students->wherehas('department', function ($q) use($spec_id) { $q->where('academystructure_departments.spec_id', $spec_id); }); } if (request('nationality_country_id')) { $nationality_country_id = request('nationality_country_id'); $students->whereHas('registration', function ($q) use($nationality_country_id) { $q->where('registrations.nationality_country_id', $nationality_country_id); }); } if (request('contact_country_id')) { $contact_country_id = request('contact_country_id'); $students->whereHas('registration', function ($q) use($contact_country_id) { $q->where('registrations.contact_country_id', $contact_country_id); }); } if ($export) { $students = $students->get(); Excel::create('students', function ($excel) use($students) { $excel->sheet('stu', function ($sheet) use($students) { $sheet->loadView('classrooms::reports.export', compact('students')); })->download('xlsx'); }); return redirect()->route('classrooms.sessions.index', $request->all()); } $per_page = request('per_page') ? request('per_page') : 30; $students = $students->paginate($per_page); $students = $students->appends($request->except("page")); $total_chosen = Student::join('classroom_students as cs', 'cs.student_id', '=', 'students.id')->join('classrooms as c', function ($j) { $j->on('c.id', '=', 'cs.classroom_id')->where('c.semester_id', '=', semester()->id); })->join('student_subjects as ss', function ($j) { $j->on('ss.subject_id', '=', 'c.subject_subject_id')->on('ss.student_id', '=', 'students.id')->where('ss.state', '=', 'study'); })->groupBy('students.id'); if ($request->has('subject_subject_id')) { $total_chosen->where('c.subject_subject_id', $request->input('subject_subject_id')); } if ($request->has('classroom_id')) { $total_chosen->where('c.id', $request->input('classroom_id')); } $total_chosen = $total_chosen->get()->count(); $total_unchosen = StudentSubject::whereIn('student_subjects.state', ['study'])->selectRaw('student_subjects.student_id')->join('classrooms', function ($j) { $j->on('classrooms.subject_subject_id', '=', 'student_subjects.subject_id')->where('classrooms.semester_id', '=', semester()->id); })->leftJoin('classroom_students', function ($j) { $j->on('classrooms.id', '=', 'classroom_students.classroom_id')->on('classroom_students.student_id', '=', 'student_subjects.student_id'); })->havingRaw('COUNT(classroom_students.id)=0')->groupBy('student_subjects.subject_id', 'student_subjects.student_id'); if ($request->has('subject_subject_id')) { $total_unchosen->where('student_subjects.subject_id', $request->input('subject_subject_id')); } $total_unchosen = $total_unchosen->get()->groupBy('student_id')->count(); $subjects = Subject::where('is_quran', 0)->pluck('name', 'id')->toArray(); $classrooms = Classroom::inCurrentSemester()->pluck('code', 'id')->toArray(); $classroom_select = config('classrooms.classroom_select'); $spec_id = Specialty::pluck('name', 'id')->toArray(); $county = Country::pluck('name', 'id')->toArray(); $inputs = request()->all(); return view('classrooms::reports.classrooms', compact('students', 'subjects', 'classrooms', 'total_chosen', 'total_unchosen', 'classroom_select', 'spec_id', 'county', 'inputs')); }
public function detail($sid) { $subjects = Subject::where('id', $sid)->findOrFail($sid)->toArray(); return view('subject::subjects.detail', compact('subjects')); }
public function students($classroom_id, $student_id = null) { $classroom = Classroom::findOrFail($classroom_id); //->has('students', '<=', 'classrooms.attendees_limit') $classrooms = Classroom::select(DB::raw('CONCAT(hour , "-", code , "-" , day) as code , id'))->where('subject_subject_id', $classroom->subject_subject_id)->whereIn('classrooms.gender', [$classroom->gender, 'b'])->inCurrentSemester()->pluck('code', 'id')->toArray(); $days = $this->days; foreach ($classrooms as $key => $value) { $day = substr($value, -1); $new_day = $days[$day]; $classrooms[$key] = substr_replace($classrooms[$key], $new_day, -1); } $subjects = Subject::where('id', $classroom->subject_subject_id)->first()->name; $students = Student::with(['classrooms' => function ($query) use($classroom_id, $student_id) { return $query->where('classrooms.id', $classroom_id); }]); if (isset($student_id)) { $students = $students->whereHas('classrooms', function ($query) use($classroom_id, $student_id) { $query->where('classrooms.id', $classroom_id)->where('students.username', $student_id); })->get(); } else { $students = $students->whereHas('classrooms', function ($query) use($classroom_id, $student_id) { $query->where('classrooms.id', $classroom_id); })->get(); } // dd($classrooms); return view('classrooms::classrooms.students', compact('students', 'classroom', 'classrooms', 'subjects')); }
public function edit($pid) { $subjects = Subject::where('is_quran', 1)->pluck('name', 'id')->toArray(); $pages = QuranPage::findOrFail($pid); return view('quran::pages.edit', compact('pages', 'subjects')); }