marshmallow/nova-totals-footer
Composer 安装命令:
composer require marshmallow/nova-totals-footer
包简介
This Laravel Nova package is used for calculating the total of the columns that you wish to show.
关键字:
README 文档
README
Laravel Nova Totals Footer
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.1laravel/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
HasManyfield 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!
marshmallow/nova-totals-footer 适用场景与选型建议
marshmallow/nova-totals-footer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 487 次下载、GitHub Stars 达 2, 最近一次更新时间为 2025 年 01 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「nova」 「laravel」 「totals」 「marshmallow」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 marshmallow/nova-totals-footer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 marshmallow/nova-totals-footer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 marshmallow/nova-totals-footer 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel Nova card that shows you your system information.
A Laravel Nova card.
A Laravel Nova package for publishable fields
A Laravel Nova package for translatable fields
A Laravel Nova Image field. you can paste or drag or chose an image
Add a summary row to gridfields (incl. totals)
统计信息
- 总下载量: 487
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-01-30
