diff --git a/app/Services/EventCalendarService.php b/app/Services/EventCalendarService.php index 36a0a46..76faa56 100644 --- a/app/Services/EventCalendarService.php +++ b/app/Services/EventCalendarService.php @@ -260,9 +260,15 @@ class EventCalendarService extends BaseService 'event_calendar.update' ); } - + $now_time = date("Y-m-d H:i:s", time()); $query = EventCalendar::query()->where('pattern_id', $pattern_id) - ->whereIn('status', [0, 1])->first(); + ->whereIn('status', [0, 1]) + ->where(function ($query) use ($now_time) { + $query->whereRaw( + "'{$now_time}' BETWEEN start_time AND end_time" + ); + }) + ->first(); $end_time = get_datetime('datetime', strtotime($end_time)); $save = [