PHPackages                             webard/nova-havingable - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Search &amp; Filtering](/categories/search)
4. /
5. webard/nova-havingable

ActiveLibrary[Search &amp; Filtering](/categories/search)

webard/nova-havingable
======================

Havingable macro for Laravel Nova fields, allowing filtering of aggregated values.

v1.1.0(1y ago)03.1k↓100%MITPHPPHP ^8.1

Since Aug 22Pushed 1y ago1 watchersCompare

[ Source](https://github.com/webard/nova-havingable)[ Packagist](https://packagist.org/packages/webard/nova-havingable)[ Docs](https://github.com/webard/nova-havingable)[ RSS](/packages/webard-nova-havingable/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (3)Used By (0)

Laravel Nova Havingable
=======================

[](#laravel-nova-havingable)

Allow filtering of values calculated by aggregate functions like `withSum`, `withCount`, etc.

Installation
------------

[](#installation)

```
composer require webard/nova-havingable
```

Description
-----------

[](#description)

Let’s say you have a Resource that calculates aggregated values, such as an Order resource that calculates the total amount of ordered products:

```
class Order extends Resource
{
    public static $model = \App\Models\Order::class;

    public static function indexQuery(NovaRequest $request, $query)
    {
        return $query
            ->withSum('lines', 'amount')
            ->withSum('lines', 'quantity');
    }

    public function resourceFields(NovaRequest $request): array
    {
        return [
            ID::make('ID', 'id'),

            Number::make('Items Sum', 'lines_sum_quantity')
                ->sortable()
                ->exceptOnForms(),

            Number::make('Amount Sum', 'lines_sum_amount')
                ->sortable()
                ->exceptOnForms(),
        ];
    }
}
```

If you want to make these fields filterable, the `filterable()` method doesn’t work because it is based on the `WHERE` clause instead of `HAVING`.

This package provides a `havingable()` macro for fields, making them available for filtering.

Usage
-----

[](#usage)

Simply add the `->havingable()` method to your Resource field:

```
Number::make('Items sum', 'lines_sum_quantity')
    ->sortable()
    ->exceptOnForms()
    ->havingable()
```

TODO
----

[](#todo)

- add tests

Contributing
------------

[](#contributing)

We welcome contributions to improve this plugin! Please follow these steps to contribute:

1. Fork the repository.
2. Create a new branch for your feature or bug fix.
3. Make your changes and commit them with descriptive messages.
4. Push your changes to your forked repository.
5. Open a pull request to the main repository.

License
-------

[](#license)

This project is licensed under the MIT License. See the [LICENSE.md](LICENSE.md) file for more details.

Contact
-------

[](#contact)

For questions or support, please open an issue on GitHub.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~32 days

Total

2

Last Release

593d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e34f6439ff69a5e372136c97bf9166d48010bfa7dd29af729e8a6db98d58335d?d=identicon)[webard](/maintainers/webard)

---

Top Contributors

[![webard](https://avatars.githubusercontent.com/u/855788?v=4)](https://github.com/webard "webard (4 commits)")

---

Tags

laravelfilternovawebard

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/webard-nova-havingable/health.svg)

```
[![Health](https://phpackages.com/badges/webard-nova-havingable/health.svg)](https://phpackages.com/packages/webard-nova-havingable)
```

###  Alternatives

[outl1ne/nova-multiselect-filter

Multiselect filter for Laravel Nova.

45802.7k3](/packages/outl1ne-nova-multiselect-filter)[outl1ne/nova-detached-filters

This Laravel Nova package allows you to detach filters from the filter dropdown

64343.5k](/packages/outl1ne-nova-detached-filters)[digital-creative/nova-mega-filter

Allows you to control the columns and filters shown on your nova resources.

87159.3k](/packages/digital-creative-nova-mega-filter)[optimistdigital/nova-detached-filters

This Laravel Nova package allows you to detach filters from the filter dropdown

64235.5k](/packages/optimistdigital-nova-detached-filters)[outl1ne/nova-input-filter

An input filter for Laravel Nova

24822.7k](/packages/outl1ne-nova-input-filter)[suenerds/nova-searchable-belongs-to-filter

Searchable Nova filter for belongsTo relationships.

29516.9k](/packages/suenerds-nova-searchable-belongs-to-filter)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
