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:
blueprint/site.yml
stats:
type: stats
reports:
- label: Authors
value: '{{ page.authorCount }}'
link: /pages/team
models/site.php
<?php
class sitePage extends Page {
public function authorCount(): string
{
return page('team')->children()->count();
}
}