Statistics
Statistics are useful and common. Consider a datagrid listing posts - we might want a “Total Posts” count displayed above the grid without firing an additional request. Notably, that statistic should take into account filtering, but should not take into account pagination.
You can whitelist stats in your Resource
:
And request them like so:
They will be returned in the meta section of the response:
You can run stats over specific attributes rather than total
:
Adapters support the following statistics out-of-the-box: count
,
average
, sum
, maximum
, and minimum
. You can also define custom
statistics: