public function sendCourseNotification() { $now = Carbon::now(); $week = $now->dayOfWeek; $hour = $now->hour; $type = "0"; $count = 0; $hour2course = [6 => 'A', 7 => '1', 8 => '2', 9 => '3', 10 => '4', 11 => 'B', 12 => '5', 13 => '6', 14 => '7', 15 => '8', 16 => '9', 17 => 'C', 18 => 'D', 19 => 'E', 20 => 'F']; $week2course = [0 => 'Sun', 1 => 'Mon', 2 => 'Tue', 3 => 'Wed', 4 => 'Thu', 5 => 'Fri', 6 => 'Sat']; $courseCollect = $this->courseRepository->getCourseByTime($week2course[$week], $hour2course[$hour]); foreach ($courseCollect as $key => $course) { $content = $course->course_nameCH . " " . $this->course_start_map[$hour2course[$hour]] . " " . $course->place; try { $this->sendNotification(null, $course, $content, $type); $count++; \Log::info("[sendCourseNotification Success] " . $content); } catch (\Exception $e) { \Log::warning("[sendCourseNotification Fail] " . $content); \Log::warning($e->getMessage()); } } return $count; }