Metrics

You're browsing the documentation for an old version of MoonShine. Consider upgrading your project to MoonShine 2.x.

Same as the control panel you can display metrics in every resource

namespace MoonShine\Resources;
 
 
use MoonShine\Metrics\ValueMetric;
 
class PostResource extends Resource
{
//...
 
public function metrics(): array
{
return [
ValueMetric::make('Completed orders')
->value(Orders::completed()->count())
];
}
 
//...
}