Laravel Community Tools by Tighten
Laravel Nova icon Nova Packages
T

Total Records

This package is possibly abandoned. Please proceed with care.

Installation Instructions

Installation

You can install the package in to a Laravel app that uses Nova via composer:

composer require techouse/total-records

Usage

To add this card to the dashboard simply open up App\Providers\NovaServiceProvider and add it to the cards method like this:

<?php

namespace App\Providers;

use Illuminate\Support\Facades\Gate;
use Laravel\Nova\{Nova, NovaApplicationServiceProvider};
use Techouse\TotalRecords\TotalRecords;

class NovaServiceProvider extends NovaApplicationServiceProvider
{
       /**
         * Get the cards that should be displayed on the Nova dashboard.
         *
         * @return array
         */
        protected function cards()
        {
            return [
                /**
                  * PARAMETERS:
                  * 
                  * @param string             $model   required - the model you want to get the total count of
                  * @param string             $title   optional - the label you want to display in the Nova Card before the model count
                  * @param \DateTimeInterface $expires optional - the cache expiry time
                  */
                new TotalRecords(App\User::class),                                            // minimum required parameters
                new TotalRecords(App\Event::class, __('Total events')),                       // with custom label
                new TotalRecords(App\Contact::class, __('Total contacts'), now()->addHour()), // cached for 1 hour
            ];
        }
}

Readme

Total Records

Latest Version on Packagist Total Downloads Licence PHP version Codacy Badge GitHub stars

A Laravel Nova card that displays the total number of records of a specific model.

When you simply want to display the total number of some model's database records. Nothing less nothing more.

Total Records

Installation

You can install the package in to a Laravel app that uses Nova via composer:

composer require techouse/total-records

Usage

To add this card to the dashboard simply open up App\Providers\NovaServiceProvider and add it to the cards method like this:

<?php

namespace App\Providers;

use Illuminate\Support\Facades\Gate;
use Laravel\Nova\{Nova, NovaApplicationServiceProvider};
use Techouse\TotalRecords\TotalRecords;

class NovaServiceProvider extends NovaApplicationServiceProvider
{
       /**
         * Get the cards that should be displayed on the Nova dashboard.
         *
         * @return array
         */
        protected function cards()
        {
            return [
                /**
                  * PARAMETERS:
                  *
                  * @param string             $model   required - the model you want to get the total count of
                  * @param string             $title   optional - the label you want to display in the Nova Card before the model count
                  * @param \DateTimeInterface $expires optional - the cache expiry time
                  */
                new TotalRecords(\App\User::class),                                            // minimum required parameters
                new TotalRecords(\App\Event::class, __('Total events')),                       // with custom label
                new TotalRecords(\App\Contact::class, __('Total contacts'), now()->addHour()), // cached for 1 hour
            ];
        }
}

Screenshots

Back to Top
Added 7 years ago
Last updated 4 Years Ago
Version v1.4.0
Nova Version *
Composer
techouse/total-records
GitHub stars 8
Packagist downloads 52,310

Favorites

12 users favorited

Rating

5.00
(out of 5)
★★★★★
★★★★
★★★
★★
3 ratings

Brought to you by Tighten

Issues/Feature Requests Stats Package Ideas