public function classrooms() { # code... $classrooms = Classroom::with('subject', 'teacher')->withCount('students')->inCurrentSemester()->where("teacher_id", teacher()->id)->get(); //$classrooms->whereIn("teacher_id", teacher()->id); return view('teachers::profile.classrooms.classrooms', compact('classrooms')); }
public function export() { Excel::create('classrooms', function ($excel) { $excel->sheet('classrooms', function ($sheet) { $classrooms = Classroom::with('subject', 'teacher')->withCount('students')->inCurrentSemester(); $classrooms = $classrooms->orderBy('id', 'desc')->get(); $sheet->loadView('classrooms::classrooms.export', compact('classrooms', 'days')); })->download('xlsx'); }); }
public function classroomsedit($student_id, $classroom_id) { $student = Student::findOrFail($student_id); //$subjects = Subject::with('classroom')->Student($student->id)->findOrFail($subject_id); $subject_id = Classroom::findOrFail($classroom_id)->subject_subject_id; $classrooms = Classroom::with('students')->where('subject_subject_id', $subject_id)->get(); // dd($subject_id); // $classroom_id= $classrooms->id; return view('students::classrooms.edit', compact('classroom_id', 'student', 'classrooms', 'student_id')); }