/** * Return the position (#1, #2, etc) of this user in the top-eaters list for this year * @return integer or null when not in the list */ public function topEatersPositionThisYear() { $entries = Registration::top_ytd(); $rank = 0; foreach ($entries as $entry) { $rank++; if ($entry->id === $this->id) { return $rank; } } return null; }
/** * Show a list of all eaters */ public function index() { return $this->setPageContent(view('top/index', ['statistics_ytd' => Registration::top_ytd(), 'statistics_alltime' => Registration::top_alltime()])); }