marshmallow/nova-totals-footer 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

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!

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 我们能提供哪些服务?
定制开发 / 二次开发

基于 marshmallow/nova-totals-footer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 487
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 23
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-30