nalingia/nova-total-records-metric

A Laravel Nova card.

1.0.1 2020-04-25 09:14 UTC

This package is auto-updated.

Last update: 2024-10-25 19:11:58 UTC


README

This package provides a metric to show how many records exist for a model.

Latest Version on Packagist License

Installation

composer require nalingia/nova-total-records-metric

Usage

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);
    }
}