marshmallow/nova-totals-footer

This Laravel Nova package is used for calculating the total of the columns that you wish to show.

Maintainers

Package info

github.com/marshmallow-packages/nova-totals-footer

pkg:composer/marshmallow/nova-totals-footer

Statistics

Installs: 487

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 1

1.2.1 2026-06-11 08:03 UTC

This package is auto-updated.

Last update: 2026-06-19 08:08:19 UTC


README

alt text

Laravel Nova Totals Footer

Latest Version on Packagist Tests Total Downloads

This Laravel Nova package adds a totals footer to your resource index tables, calculating the total of any columns you choose.

Screenshot

Requirements

  • php: ^8.1
  • laravel/nova: ^5.0

Installation

Install the package via Composer:

composer require marshmallow/nova-totals-footer

The package is a Nova tool and is auto-discovered — no further registration is needed.

Usage

To include a field in the table footer, call its calculate() method and describe the calculation. The available methods are sum, count, avg, min and max:

use Laravel\Nova\Fields\Currency;

Currency::make('Revenue', 'revenue')
    ->required()

    /** 👇 This is where the magic happens */
    ->calculate(
        method: 'sum',     // sum, count, avg, min, max
        title: 'Total',
        prefix: '$',
        postfix: '.00',
        hideTitle: true,   // true, false (default)
        align: 'right',    // left, right (default), center
        titleAlign: 'right', // left, right (default), center
        decimals: 2,       // number of decimals to format the total with (default: 0)
    ),

When the resource is shown through a relationship (e.g. a HasMany field on another resource), the footer totals are calculated over the related records only, matching the rows in the table.

Hide the footer header

Sometimes you don't want the extra title row above the totals. You can hide it:

use Marshmallow\NovaTotalsFooter\NovaTotalsFooter;

NovaTotalsFooter::hideHeader();

Static analysis (PHPStan / Larastan)

calculate() is a runtime macro on Nova's Field, so static analysers don't know about it by default. Register the shipped stub in your phpstan.neon so it's recognised (no more @phpstan-ignore on every call):

parameters:
    stubFiles:
        - vendor/marshmallow/nova-totals-footer/stubs/calculate-macro.stub

Testing

The package ships a Pest + Orchestra Testbench suite. Nova is a private dependency, so configure your credentials before installing:

composer config http-basic.nova.laravel.com "your-email" "your-license-key"
composer install
composer test

CI (.github/workflows/tests.yml) runs the suite against PHP 8.2–8.4 and expects NOVA_USERNAME and NOVA_PASSWORD repository secrets.

Contributing

Feel free to suggest changes, ask for new features or fix bugs yourself. We're sure there are still a lot of improvements that could be made, and we would be very happy to merge useful pull requests.

Security Vulnerabilities

Please report security vulnerabilities by email to hello@marshmallow.nl rather than via the public issue tracker.

Credits

License

The MIT License (MIT). Please see the License File for more information.

💖 Sponsorships

If you are reliant on this package in your production applications, consider sponsoring us! It is the best way to help us keep doing what we love to do: making great open source software.

Made with ❤️ for open source

At Marshmallow we use a lot of open source software as part of our daily work. So when we have an opportunity to give something back, we're super excited!

We hope you will enjoy this small contribution from us and would love to hear from you if you find it useful in your projects. Follow us on Twitter for more updates!