This package provides a metric to show how many records exist for a model.
composer require nalingia/nova-total-records-metric
Use the trait HasTotal
in your metric class and use the total
method.
use Nalingia\TotalRecords\HasTotal;
class TotalUsers extends Value
{
use HasTotal;
/**
* Calculate the value of the metric.
*
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
* @return mixed
*/
public function calculate(NovaRequest $request)
{
return $this->total($request, User::class);
}
}