Add april fools stuff
This commit is contained in:
parent
e1778fcd59
commit
e37c663c43
9 changed files with 194 additions and 22 deletions
|
|
@ -17,13 +17,16 @@ public function __construct() {}
|
|||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string {
|
||||
$event = '';
|
||||
if ($this->isItChristmas()) $event = 'christmas';
|
||||
if ($this->isItAprilFools()) $event = 'april-fools';
|
||||
if (isLegacy()) {
|
||||
return view('components.layout-legacy', [
|
||||
'isChristmas' => $this->isItChristmas()
|
||||
'event' => $event
|
||||
]);
|
||||
} else {
|
||||
return view('components.layout', [
|
||||
'isChristmas' => $this->isItChristmas()
|
||||
'event' => $event
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -37,4 +40,15 @@ public function isItChristmas() : bool {
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue