public function addClassDetail($classId, $classroomId, $teacherId, $date, $startTime, $endTime) { try { $tId = session('instId'); $dayOfWeek = date('w', strtotime($date)); //get the dayOfWeek of this timestamp if ($dayOfWeek == 0) { $dayOfWeek = 7; } $ymd = explode('-', $date); $year = $ymd[0]; $month = $ymd[1]; $startTimeInt = str_replace(':', '', $startTime); //save class detail $class = new \Home\Model\ClassModel(); $classDetailId = $class->saveClassDetail($date, $year, $month, $dayOfWeek, $startTime, (int) $startTimeInt, $endTime, $teacherId, $classroomId, $classId, $tId); $data = "true"; } catch (Exception $e) { $data = "false"; } $this->ajaxReturn($data); }