value('value') !== 'true') { return true; } $at = Carbon::parse($dateTime); $dayMap = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat']; $workingDays = array_filter(array_map('trim', explode(',', Setting::where('key', 'working_days')->value('value') ?: 'sat,sun,mon,tue,wed'))); if (!in_array($dayMap[$at->dayOfWeek], $workingDays, true)) { return false; } $holidays = array_filter(array_map('trim', explode(',', Setting::where('key', 'custom_holidays')->value('value') ?: ''))); if (in_array($at->toDateString(), $holidays, true)) { return false; } $start = Setting::where('key', 'working_hours_start')->value('value') ?: '09:00'; $end = Setting::where('key', 'working_hours_end')->value('value') ?: '18:00'; $time = $at->format('H:i'); return $time >= $start && $time <= $end; } }