/**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $this->comment(PHP_EOL . 'modifiyng' . PHP_EOL);
     $sessions = ClassroomSession::select('id', 'teacher_id', 'admin_link', 'subject_subject_id', 'interval_id', 'title', 'wiziq_id', 'duration', 'start_at')->whereDate('start_at', '=', date('Y-m-d'))->with('subject', 'interval', 'teacher')->get();
     foreach ($sessions as $session) {
         try {
             $classroom = WiziqClassroom::build($session->interval->title . " - " . $session->subject->name, new \DateTime($session->start_at))->withDuration($session->duration)->withPresenter($session->teacher->id, $session->teacher->name)->withAttendeeLimit(config("classrooms.attendee_limit"))->withReturnUrl('')->withCreateRecording(true)->withPresenterDefaultControls('audio, video')->withTimeZone("Asia/Muscat")->withStatusPingUrl("https://www.google.com")->withLanguageCultureName("ar-SA");
             $WiziqApi = new WiziqApi();
             $WiziqApi->modify($session->wiziq_id, $classroom);
             $attendees = Attendees::build()->add(9999999999.0, 'النظام', 'ar-SA');
             $response = $WiziqApi->addAttendeesToClass($session->wiziq_id, $attendees);
             $session->admin_link = $response[0]['url'];
             $session->save();
         } catch (\mikemix\Wiziq\Common\Api\Exception\CallException $e) {
             Mail::send('emails.classrooms_modify', ['error' => $e->getMessage(), 'time' => $session->start_at], function ($m) {
                 $m->to('*****@*****.**', 'علي اليزيدي')->to('*****@*****.**', 'محسن بخيش')->subject('حدث مشكل اثناء تعديل الفصول');
             });
             $this->comment(PHP_EOL . $e->getMessage() . " - " . $session->id . ' - ' . $session->start_at . PHP_EOL);
         } catch (\mikemix\Wiziq\Common\Http\Exception\InvalidResponseException $e) {
             Mail::send('emails.classrooms_modify', ['error' => $e->getMessage(), 'time' => $session->start_at], function ($m) {
                 $m->to('*****@*****.**', 'علي اليزيدي')->to('*****@*****.**', 'محسن بخيش')->subject('حدث مشكل اثناء تعديل الفصول');
             });
             $this->comment(PHP_EOL . $e->getMessage() . " - " . $session->id . ' - ' . $session->start_at . PHP_EOL);
         }
     }
     $this->comment(PHP_EOL . 'finished modifiyng' . PHP_EOL);
 }
Esempio n. 2
0
 public function index()
 {
     $semester = semester();
     //    $finish = $semester ? $semester->finish_at : date('Y-m-d');
     //    if ($semester->order != 'first') {
     //    $semester= Semester::where('order', 'first')
     //                       ->where('start_at', '>', $finish)
     //                       ->orderBy('start_at', 'ASC')
     //                       ->first();
     //    }
     //    return $semester;
     $students_by_years = Year::selectRaw("\n            academystructure_years.name,\n            SUM(IF(stu.gender='m',1,0)) AS males,\n            SUM(IF(stu.gender='f',1,0)) AS females")->leftJoin('academystructure_terms AS at', 'at.year_id', '=', 'academystructure_years.id')->leftJoin('academystructure_departments AS ad', 'ad.term_id', '=', 'at.id')->leftJoin('student_histories AS sh', function ($join) {
         $join->on('sh.academystructure_department_id', '=', 'ad.id')->where('academycycle_semester_id', '=', semester()->id);
     })->leftJoin('students AS stu', 'stu.id', '=', 'sh.student_id')->groupBy('academystructure_years.id')->get();
     $students_by_state = Student::selectRaw("DISTINCT students.id,\n          students.state,\n        \tSUM(IF(students.state='active',1,0)) AS active_all_students,\n        \tSUM(IF(students.state='delayed',1,0)) AS delayed_all_students,\n        \tSUM(IF(students.state='discontinuous',1,0)) AS discontinuous_all_students,\n        \tSUM(IF(students.state='withdrawn',1,0)) AS withdrawn_all_students,\n        \tSUM(IF(students.state='fired',1,0)) AS fired_all_students,\n        \tSUM(IF(students.state='graduate',1,0)) AS graduate_all_students,\n\n        \tSUM(IF(students.gender='m' AND students.state='active',1,0)) AS active_male_students,\n        \tSUM(IF(students.gender='m' AND students.state='delayed',1,0)) AS delayed_male_students,\n        \tSUM(IF(students.gender='m' AND students.state='discontinuous',1,0)) AS discontinuous_male_students,\n        \tSUM(IF(students.gender='m' AND students.state='withdrawn',1,0)) AS withdrawn_male_students,\n        \tSUM(IF(students.gender='m' AND students.state='fired',1,0)) AS fired_male_students,\n        \tSUM(IF(students.gender='m' AND students.state='graduate',1,0)) AS graduate_male_students,\n\n        \tSUM(IF(students.gender='f' AND students.state='active',1,0)) AS active_female_students,\n        \tSUM(IF(students.gender='f' AND students.state='delayed',1,0)) AS delayed_female_students,\n        \tSUM(IF(students.gender='f' AND students.state='discontinuous',1,0)) AS discontinuous_female_students,\n        \tSUM(IF(students.gender='f' AND students.state='withdrawn',1,0)) AS withdrawn_female_students,\n        \tSUM(IF(students.gender='f' AND students.state='fired',1,0)) AS fired_female_students,\n        \tSUM(IF(students.gender='f' AND students.state='graduate',1,0)) AS graduate_female_students\n        \t")->first();
     // return $students_by_state;
     $genders = Student::selectRaw("\n            SUM(IF(students.gender='m',1,0)) AS males,\n            SUM(IF(students.gender='f',1,0)) AS females")->join('student_histories AS sh', function ($join) {
         $join->on('sh.student_id', '=', 'students.id')->whereIn('sh.study_state', ['active', 'success', 'fail'])->where('academycycle_semester_id', '=', semester()->id);
     })->isStudying()->first();
     $sessions = ClassroomSession::selectRaw("DATE(start_at) as start_at,SUM(IF(canceled=0,1,0)) AS held, SUM(IF(canceled=1,1,0)) AS canceled")->whereDate('start_at', '>=', date('Y-m-d', strtotime('-30 days')))->groupBy(\DB::raw('DATE(start_at)'))->get();
     $session_per_days = [];
     for ($i = 30; $i > 0; $i--) {
         if ($session = $sessions->whereLoose('start_at', date('Y-m-d 00:00:00', strtotime("-" . $i . " days")))->first()) {
             $session_per_days[] = $session;
         } else {
             $session_per_days[] = ['held' => 0, 'canceled' => 0, 'start_at' => date('Y-m-d 00:00:00', strtotime("-" . $i . " days"))];
         }
     }
     return view('dashboards.admin', compact('semester', 'genders', 'students_by_years', 'students_by_state', 'session_per_days'));
 }
Esempio n. 3
0
 public function index()
 {
     $sessions = ClassroomSession::whereHas('studentsSessions', function ($query) {
         $query->where('student_id', student()->id);
     })->with(['classroom.subject', 'classroom.teacher', 'studentsSessions'])->orderBy('canceled', 'asc')->orderBy('start_at', 'asc')->paginate(30);
     // return $sessions;
     return view('students::sessions.index', compact('sessions'));
 }
 public function create()
 {
     $sessions = ClassroomSession::with('classroom', 'classroom.subject')->whereHas('attendances', function ($query) {
         return $query->where('student_id', student()->id)->where('valid', 0);
     })->get();
     $options = [];
     foreach ($sessions as $session) {
         $title = $session->classroom->code . " :: " . $session->classroom->subject->name . " :: " . $session->title;
         $options[$session->id] = $title;
     }
     return view("students::orders.sessionexcuses.create", compact('sessions', 'options'));
 }
Esempio n. 5
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $sessions = ClassroomSession::select('id', 'classroom_id')->whereIn('classroom_id', [157, 168, 176, 186, 198, 213, 217])->get();
     // $this->comment(PHP_EOL.$sessions->count().PHP_EOL);
     foreach ($sessions as $session) {
         $students = ClassroomStudent::select('student_id')->where('student_id', 1841)->where('classroom_id', $session->classroom_id)->get();
         // $this->comment(PHP_EOL.$students->count().PHP_EOL);
         foreach ($students as $student) {
             $exist = StudentClassroomSession::where('classroom_session_id', $session->id)->where('student_id', $student->student_id)->value('id');
             if ($exist) {
                 $this->comment(PHP_EOL . ' HAS ' . $exist . PHP_EOL);
             } else {
                 $data = ['student_id' => $student->student_id, 'attendee_id' => $student->student_id, 'classroom_session_id' => $session->id, 'student_link' => '', 'semester_id' => 9];
                 $attendance = ['entry_time' => null, 'exit_time' => null, 'attended_minutes' => null, 'teacher_id' => null, 'classroom_session_id' => $session->id, 'student_id' => $student->id, 'valid' => 0, 'manual' => 0];
                 StudentClassroomSession::create($data);
                 ClassroomSessionAttendance::create($attendance);
                 $this->comment(PHP_EOL . ' NOT ' . PHP_EOL);
             }
         }
     }
     // Student::with('classrooms', 'subjects')->has('classrooms',  '=', 3)->leftJoin('subject_sub')
     exit;
     \DB::connection()->enableQueryLog();
     Exam::select('exams.type', 'exams.start_at', 'exams.finish_at', 'exams.name', 'exams.id')->join('subject_subjects as subsub', 'subsub.id', '=', 'exams.subject_id')->join('student_subjects as stusub', function ($j) {
         $j->on('stusub.subject_id', '=', 'subsub.id')->where('stusub.student_id', '=', 10001)->where('stusub.state', '=', 'study');
     })->where(function ($query) {
         $query->orWhereIn('exams.type', ['midterm', 'remidterm', 'activity'])->orWhereRaw('exams.id IN (SELECT ce.exam_id FROM classrooms_exam as ce
                             JOIN classrooms as c ON c.id = ce.classroom_id
                             JOIN classroom_students as cs ON cs.classroom_id = c.id
                                 AND cs.student_id = 10001
                             WHERE exam_id = exams.id GROUP BY ce.id)');
         // if ($request->has('finalExam') == 'true') {
         //     $query->orWhereIn('exams.type',
         //         [
         //     'final',
         //                 'summer',
         //                 'refinal'
         //         ]);
         // }
     })->where('exams.semester_id', 9)->where('finish_at', '>=', date('Y-m-d H:i:s'))->groupBy('exams.id')->orderBy('exams.start_at', 'ASC')->get();
     // Exam::count();
     $query = \DB::getQueryLog();
     $lastQuery = end($query);
     var_dump($lastQuery);
     // echo "done";
     exit;
     // $sessions = ClassroomSession::select('id')->whereIn('interval_id', [2,14,15])->get();
     // foreach ($sessions as $session) {
     //     ClassroomSessionAttendance::where('classroom_session_id', $session->id)->update(['valid' => 1]);
     // }
 }
 private function createClassrooms($interval)
 {
     $classrooms = $interval->classrooms;
     $WiziqApi = new WiziqApi();
     if (App::environment() == 'local') {
         $status_ping_url = 'http://46.40.236.186:9090/DARES/public/classrooms/classrooms/status_ping';
         // $status_ping_url = 'https://el-css.edu.om/admin/public/classrooms/classrooms/status_ping';
     } else {
         $status_ping_url = 'https://google.com';
         // $status_ping_url = 'https://el-css.edu.om/admin/public/classrooms/classrooms/status_ping';
     }
     // Log::info($status_ping_url);
     foreach ($classrooms as $classroom) {
         $error = 0;
         $subject = $classroom->subject;
         $teacher = $classroom->teacher;
         $increment_date = Date::parse($interval->from_date . " " . $classroom->hour);
         while ($increment_date->format("Y-m-d H:i:s") <= $interval->to_date . " 23:59:59") {
             $exists = ClassroomSession::where('start_at', $increment_date->format("Y-m-d H:i:s"))->where('classroom_id', $classroom->id)->count();
             if ($increment_date->dayOfWeek == $classroom->day && $increment_date->isFuture() && !$exists) {
                 try {
                     $wiziqclassroom = WiziqClassroom::build($interval->title . " - " . $subject->name, new DateTime($increment_date->format("Y-m-d H:i:s")))->withPresenter($teacher->id, $teacher->name)->withAttendeeLimit(config("classrooms.attendee_limit"))->withReturnUrl('')->withDuration(60)->withExtendDuration(0)->withStatusPingUrl($status_ping_url)->withTimeZone("Asia/Muscat")->withLanguageCultureName("ar-SA")->withCreateRecording(true);
                     $response = $WiziqApi->create($wiziqclassroom);
                     $data = ['title' => $interval->title, 'wiziq_id' => $response['class_id'], 'interval_id' => $interval->id, 'classroom_id' => $classroom->id, 'subject_subject_id' => $subject->id, 'teacher_id' => $teacher->id, 'start_at' => $increment_date->format("Y-m-d H:i:s"), 'duration' => 60, 'recording_link' => $response['recording_url'], 'presenter_link' => $response['presenter_url']];
                     /** add attendees to virtual classroom */
                     if ($session = ClassroomSession::create($data)) {
                         $error = $this->createStudentsSessions($classroom->students, $session);
                     }
                     //\Log::info($response);
                 } catch (\mikemix\Wiziq\Common\Api\Exception\CallException $e) {
                     // \Log::warning($e->getMessage());
                     $error = 1;
                 } catch (\mikemix\Wiziq\Common\Http\Exception\InvalidResponseException $e) {
                     // \Log::warning($e->getMessage());
                     $error = 1;
                 } catch (\PDOException $e) {
                     $error = 1;
                 }
             }
             $increment_date->add("1 day");
         }
         if ($error == 0) {
             $interval->state = 'done';
             $interval->save();
             event(new IntervalVirtualClassroomsCreated($interval->title));
         }
     }
 }
Esempio n. 7
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $this->comment(PHP_EOL . 'adding' . PHP_EOL);
     $sessions = ClassroomSession::select('classroom_sessions.wiziq_id', 'classroom_sessions.id', 'classroom_sessions.classroom_id')->whereDate('classroom_sessions.start_at', '>', date('Y-m-d'))->with(['classroom' => function ($query) {
         return $query->select('classrooms.id');
     }, 'classroom.students' => function ($query) {
         return $query->select('students.id', 'students.name');
     }, 'studentsSessions' => function ($query) {
         return $query->select('student_id', 'classroom_session_id');
     }])->get();
     foreach ($sessions as $session) {
         $classroomId = $session->wiziq_id;
         $error = 0;
         $WiziqApi = new WiziqApi();
         // var_dump($session->classroom->students->count());
         foreach ($session->classroom->students as $student) {
             $exist = $session->studentsSessions->filter(function ($value) use($student) {
                 return $value->student_id == $student->id;
             });
             if ($exist->count()) {
                 continue;
             }
             $this->comment(PHP_EOL . ' not exist ' . PHP_EOL);
             try {
                 $attendees = Attendees::build()->add($student->id, $student->name, 'ar-SA');
                 // add more if needed
                 $response = $WiziqApi->addAttendeesToClass($classroomId, $attendees);
                 $data = ['student_link' => $response[0]['url'], 'attendee_id' => $response[0]['id'], 'classroom_session_id' => $session->id, 'student_id' => $student->id, 'semester_id' => semester()->id];
                 StudentClassroomSession::create($data);
             } catch (\mikemix\Wiziq\Common\Api\Exception\CallException $e) {
                 $this->comment(PHP_EOL . ' call exception ' . PHP_EOL);
                 $error = 1;
             } catch (\mikemix\Wiziq\Common\Http\Exception\InvalidResponseException $e) {
                 $this->comment(PHP_EOL . ' invalid response exception ' . PHP_EOL);
                 $error = 1;
             } catch (\ErrorException $e) {
                 $this->comment(PHP_EOL . ' error exception ' . PHP_EOL);
                 $error = 1;
             }
         }
     }
     $this->comment(PHP_EOL . 'added' . PHP_EOL);
 }
Esempio n. 8
0
 public function register()
 {
     //Classroom
     Classroom::created(function ($classroom) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'classrooms', 'reference_id' => $classroom->id]);
     });
     Classroom::updated(function ($classroom) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'classrooms', 'reference_id' => $classroom->id]);
     });
     Classroom::deleted(function ($classroom) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'classrooms', 'reference_id' => $classroom->id]);
     });
     //ClassroomInterval
     ClassroomInterval::created(function ($classroominterval) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'classroom_intervals', 'reference_id' => $classroominterval->id]);
     });
     ClassroomInterval::updated(function ($classroominterval) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'classroom_intervals', 'reference_id' => $classroominterval->id]);
     });
     ClassroomInterval::deleted(function ($classroominterval) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'classroom_intervals', 'reference_id' => $classroominterval->id]);
     });
     //ClassroomSessionExcuse
     ClassroomSessionExcuse::created(function ($classroomsessionexcuses) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'classroom_session_excuses', 'reference_id' => $classroomsessionexcuses->id]);
     });
     ClassroomSessionExcuse::updated(function ($classroomsessionexcuses) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'classroom_session_excuses', 'reference_id' => $classroomsessionexcuses->id]);
     });
     ClassroomSessionExcuse::deleted(function ($classroomsessionexcuses) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'classroom_session_excuses', 'reference_id' => $classroomsessionexcuses->id]);
     });
     //ClassroomSession
     ClassroomSession::created(function ($classroomsession) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'classroom_sessions', 'reference_id' => $classroomsession->id]);
     });
     ClassroomSession::updated(function ($classroomsession) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'classroom_sessions', 'reference_id' => $classroomsession->id]);
     });
     ClassroomSession::deleted(function ($classroomsession) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'classroom_sessions', 'reference_id' => $classroomsession->id]);
     });
 }
Esempio n. 9
0
 public function exportteachertable(Request $request)
 {
     $sessions = ClassroomSession::with(['teacher', 'classroom', 'subject']);
     if ($request->has('teacher_id')) {
         $sessions->whereHas('teacher', function ($q) use($request) {
             $q->where('id', $request->input('teacher_id'));
         });
     }
     $sessions = $sessions->get();
     Excel::create('sessions', function ($excel) use($sessions) {
         $excel->sheet('teacher_table', function ($sheet) use($sessions) {
             $sheet->loadView('classrooms::reports.exportteachertable', compact('sessions', 'teachers'));
         });
     })->download('xlsx');
 }
Esempio n. 10
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $this->comment(PHP_EOL . 'adding' . PHP_EOL);
     $WiziqApi = new WiziqApi();
     // $report = $WiziqApi->getAttendanceReport(5435948);
     // var_dump($report);
     // exit;
     $sessions = ClassroomSession::select('classroom_sessions.id', 'classroom_sessions.wiziq_id', 'classroom_sessions.title', 'classroom_sessions.classroom_id', 'classroom_sessions.subject_subject_id')->leftJoin('classroom_session_attendances as csa', 'classroom_sessions.id', '=', 'csa.classroom_session_id')->whereNull('csa.id')->with('subject')->groupBy('classroom_sessions.id')->whereCanceled(0)->whereDate('classroom_sessions.start_at', '>', date('2016-10-30'))->where('start_at', '<', date('Y-m-d H:i:s', strtotime('-60 minutes')))->get();
     $this->comment(PHP_EOL . $sessions->count() . PHP_EOL);
     foreach ($sessions as $session) {
         $all_classroom_students = ClassroomStudent::where('classroom_id', $session->classroom_id)->where('semester_id', semester()->id)->pluck('student_id')->toArray();
         // $WiziqApi = new WiziqApi;
         try {
             $report = $WiziqApi->getAttendanceReport($session->wiziq_id);
         } catch (\mikemix\Wiziq\Common\Api\Exception\CallException $e) {
             continue;
         }
         if (empty($report)) {
             continue;
         }
         ClassroomSession::where('id', $session->id)->update(['wiziq_status' => 'completed', 'wiziq_recording_status' => 'available']);
         // $session->wiziq_status = 'completed';
         // $session->wiziq_recording_status = 'available';
         // $session->save();
         $attendances = collect();
         // var_dump($report);
         // exit;
         // dd('out');
         foreach ($report as $attendee) {
             $student_id = NULL;
             $teacher_id = NULL;
             if (empty($attendee['presenter_id']) && !empty($attendee['attendee_id'])) {
                 $student_id = $attendee['attendee_id'];
                 if (!in_array($student_id, $all_classroom_students)) {
                     continue;
                 }
             } elseif (!empty($attendee['presenter_id'])) {
                 $teacher_id = $attendee['presenter_id'];
             } else {
                 continue;
             }
             $data = ['teacher_id' => $teacher_id, 'student_id' => $student_id, 'classroom_session_id' => $session->id, 'entry_time' => Date::parse($attendee['entry_time'])->format('Y-m-d H:i:s'), 'exit_time' => Date::parse($attendee['exit_time'])->format('Y-m-d H:i:s'), 'attended_minutes' => $attendee['attended_minutes']];
             $attendance = ClassroomSessionAttendance::create($data);
             if ($student_id && in_array($student_id, $all_classroom_students)) {
                 $data = ['student_id' => $student_id, 'subject_id' => $session->subject_subject_id, 'value' => $session->subject->hours == 2 ? 2.5 : 2, 'ref_key' => 'attendance', 'notes' => trans('classrooms::attendances.attended_for', ['attended_minutes' => $attendance->attended_minutes, 'session' => $session->title, 'subject' => $session->subject->name]), 'ref_value' => $attendance->id];
                 $StudentGrade = new StudentGrade();
                 $StudentGrade->fill($data)->save();
             } else {
                 // $data['teacher_id'] = $attendance->teacher_id;
                 TeacherFund::create(['teacher_id' => $teacher_id, 'amount' => config('classrooms.payment_per_session'), 'reference_key' => 'session', 'reference_id' => $session->id, 'semester_id' => semester()->id]);
             }
             $attendances->push($attendance);
         }
         $student_ids = $attendances->whereLoose('teacher_id', NULL)->pluck('student_id')->toArray();
         $students = Student::whereHas('classrooms', function ($query) use($session) {
             return $query->where('classrooms.id', $session->classroom_id);
         })->whereNotIn('id', $student_ids)->get();
         foreach ($students as $student) {
             $data = ['teacher_id' => NULL, 'student_id' => $student->id, 'classroom_session_id' => $session->id, 'entry_time' => NULL, 'exit_time' => NULL, 'attended_minutes' => 0, 'manual' => 1, 'valid' => 0];
             event(new StudentAbsentSession($student, $session, $session->subject));
             ClassroomSessionAttendance::create($data);
             // $attendances->push($attendance);
         }
     }
     $this->comment(PHP_EOL . 'added' . PHP_EOL);
 }
 public function classroomsessionssummarysave(Request $request)
 {
     $ClassroomSession = ClassroomSession::findOrFail($request->id);
     $ClassroomSession->summary = $request->file;
     $ClassroomSession->save();
     $message = 'تم رفع الملف بنجاح ';
     return redirect()->route('teachers.profile.classroomsessions')->with('success', $message);
 }
 public function regiserEvents()
 {
     Classroom::creating(function ($classroom) {
         $classroom->semester_id = semester()->id;
     });
     ClassroomInterval::creating(function ($interval) {
         $interval->semester_id = semester()->id;
     });
     ClassroomSession::creating(function ($session) {
         $session->semester_id = semester()->id;
     });
 }
Esempio n. 13
0
 public function updatedetails(ClassroomSession $session, Request $request)
 {
     if (!$session->is_done && $session->canceled) {
         return redirect()->route('classrooms.sessions.index')->with('error', trans('classrooms::sessions.cant_modify_started_sessions'));
     }
     $session->fill($request->only('details_is_in_time', 'details_is_teacher_absent', 'details_is_tech_problem', 'details_is_delayed', 'details_is_board_used', 'details_is_camera_used', 'details_teacher_level_summary', 'details_teacher_level_tech', 'details_notes'));
     $session->save();
     return redirect()->route('classrooms.sessions.index');
 }
Esempio n. 14
0
 public function index()
 {
     $sessions = ClassroomSession::orderBy('canceled', 'asc')->orderBy('start_at', 'asc')->teacher()->orderBy('canceled', 'asc')->orderBy('start_at', 'asc')->paginate(100);
     return view('teachers::profile.index', compact('sessions'));
 }