isItChristmas()) $event = 'christmas'; if ($this->isItAprilFools()) $event = 'april-fools'; if (isLegacy()) { return view('components.layout-legacy', [ 'event' => $event ]); } else { return view('components.layout', [ 'event' => $event ]); } } public function isItChristmas() : bool { $currentDate = new DateTime(); $currentYear = intval($currentDate->format('Y')); $startDate = new DateTime("$currentYear-11-10"); $endDate = new DateTime(($currentYear + 1) . "-01-01"); return $currentDate >= $startDate && $currentDate < $endDate; } public function isItAprilFools() : bool { $currentDate = new DateTime(); $currentDate->setTime(0, 0); $currentYear = intval($currentDate->format('Y')); $aprilFools = new DateTime("$currentYear-04-01"); return $currentDate == $aprilFools; } }