示例#1
0
 public function exitClassroom(ExitClassroomRequest $request)
 {
     $input = $request->all();
     $student = student();
     $student->classrooms()->detach($input['classroom_id']);
     event(new StudentExitClassroom(Classroom::find($input['classroom_id']), $student, new User()));
     return redirect()->route('students.profile.classrooms.index');
 }
示例#2
0
 public function delete(Request $request)
 {
     $input = $request->all();
     $this->student->classrooms()->detach($input['classroom_id']);
     event(new StudentExitClassroom(Classroom::find($input['classroom_id']), $this->student, new User()));
     $classroom = Classroom::select('cs.student_id as chosen', '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', '=', $this->student->id);
     })->leftJoin('classroom_students as cs', function ($j) {
         $j->on('cs.classroom_id', '=', 'classrooms.id')->where('cs.student_id', '=', $this->student->id)->where('cs.semester_id', '=', semester()->id);
     })->whereIn('classrooms.gender', [$this->student->gender, 'b'])->with('subject')->withCount('students')->find($input['classroom_id']);
     return response()->json($classroom, 200, [], JSON_NUMERIC_CHECK);
 }
示例#3
0
 public function changeClassroom(Request $request, $classroom_id)
 {
     $ids = $request->input('table_records');
     $new_classroom_id = $request->input('new_classroom_id');
     $notes = $request->input('notes');
     /*$sem_id = semester()->id;
     		$new_classroom = new classrooms();
     		$new_classroom->classroom_id = $new_classroom_id;
     		$new_classroom->semester_id = $sem_id;
     		*/
     if (!empty($ids) && is_array($ids)) {
         foreach ($ids as $id) {
             $student = Student::find($id);
             $student->classrooms()->detach($classroom_id);
             event(new StudentExitClassroom(Classroom::find($classroom_id), $student, user(), $notes));
             $student->classrooms()->attach([$request->input('new_classroom_id') => ['semester_id' => semester()->id]]);
             event(new StudentChoseClassroom(Classroom::find($new_classroom_id), $student, user(), $notes));
         }
     }
     return redirect()->route('classrooms.classrooms.students', $new_classroom_id);
 }
示例#4
0
 public function exitClassroom(ExitClassroomRequest $request)
 {
     $input = $request->all();
     $student = student();
     $student->classrooms()->detach([$input['classroom_id'] => ['student_id' => $request->input('student_id')]]);
     event(new StudentExitClassroom(Classroom::find($input['classroom_id']), $student, new User()));
     return redirect()->route('students.subjects.classrooms', $request->input('student_id'));
 }