Stats section: counting pages

I’m working on a website for a magazine, in the panel homepage I would like to show the count of articles and authors.

I tested the function page('team')->children()->count(); in the frontend and it works, but I’m not able to make it work in the panel area.

Last attempt works like this:


  type: stats
    - label: Authors
      value: '{{ page.authorCount }}'
      link: /pages/team



class sitePage extends Page {

  public function authorCount(): string
    return page('team')->children()->count();

The site is not a page and cannot have a model, use a site method instead

Many thanks @texnixe !
Using the site methods it works!