<?php

class SeasonPage extends Page {
  public function getAllGames() {
    $children = new Pages();
    foreach ($this->children() as $key => $value) {
      $children->add($value->children());
    }
    return $children;
  }
  public function getRunningTournaments() {
    return $this->children()->filter(
      fn ($child) => $child->date()->isEmpty() or $child->date()->toDate()+(60*60*24) > time()
    )->sortBy('date', 'asc');
  }
}
