public function change_class(Request $request) { $classLessonTo = ClassLesson::find($request->class_lesson_id_to); $classLessonFrom = ClassLesson::find($request->class_lesson_id_from); $register = $this->user->registers()->where('class_id', $request->origin_class_id)->first(); $attendance = $classLessonFrom->attendances()->where('register_id', $register->id)->first(); $attendance->class_lesson_id = $classLessonTo->id; $attendance->save(); Session::flash('message', 'Bạn đã chuyển buổi <strong style="font-weight: bold">' . $classLessonFrom->lesson->order . ': ' . $classLessonFrom->lesson->name . '</strong> sang lớp <strong style="font-weight: bold">' . $classLessonTo->studyClass->name . '</strong> thành công'); return redirect('student/classes/' . $request->origin_class_id); }
public function attendance_list(Request $request, $id) { $classLesson = ClassLesson::find($id); $attendance_list = $classLesson->attendances; $currentGen = Gen::getCurrentGen(); $this->data['current_gen'] = $currentGen; $this->data['attendances'] = $attendance_list; $this->data['classLesson'] = $classLesson; $this->data['current_tab'] = 18; return view('manage.attendance_list', $this->data); }