PHPackages                             marshmallow/nova-global-filter - 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. [Admin Panels](/categories/admin)
4. /
5. marshmallow/nova-global-filter

ActiveLibrary[Admin Panels](/categories/admin)

marshmallow/nova-global-filter
==============================

This package allows you to broadcast any of your existing Laravel Nova filters to metrics or custom cards.

v5.0.0(10mo ago)04121MITVuePHP ^8.1CI failing

Since Jan 7Pushed 3w ago2 watchersCompare

[ Source](https://github.com/marshmallow-packages/nova-global-filter)[ Packagist](https://packagist.org/packages/marshmallow/nova-global-filter)[ RSS](/packages/marshmallow-nova-global-filter/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (2)Versions (5)Used By (0)

[![alt text](https://camo.githubusercontent.com/f5450f299f5713ce2f04dd5a1ba7ce9960ed4568b3574e4c4ee3cddc75477253/68747470733a2f2f6d617273686d616c6c6f772e6465762f63646e2f6d656469612f6c6f676f2d7265642d3233377834362e706e67 "marshmallow.")](https://camo.githubusercontent.com/f5450f299f5713ce2f04dd5a1ba7ce9960ed4568b3574e4c4ee3cddc75477253/68747470733a2f2f6d617273686d616c6c6f772e6465762f63646e2f6d656469612f6c6f676f2d7265642d3233377834362e706e67)

Nova Global Filter
==================

[](#nova-global-filter)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8483381058c2d3cb87783fa886da626ccf6366d6e689cc1980ee720ee1bd73cd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d617273686d616c6c6f772f6e6f76612d676c6f62616c2d66696c7465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/marshmallow/nova-global-filter)[![Total Downloads](https://camo.githubusercontent.com/b25b67551281947dddde6017c23377e6011466b4d731471bd22f4d1e6b969e82/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d617273686d616c6c6f772f6e6f76612d676c6f62616c2d66696c7465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/marshmallow/nova-global-filter)

This package allows you to broadcast any of your existing Laravel Nova filters to metrics or custom cards.

[![screenshot](resources/gifs/nova-global-filter.gif)](resources/gifs/nova-global-filter.gif)

Important

This package was originally forked from [nemrutco/nova-global-filter](https://github.com/nemrutco/nova-global-filter). Since we were making many opinionated changes and the owner archived the repository, we decided to continue development in our own version rather than submitting pull requests that might not benefit all users of the original package. You're welcome to use this package, we're actively maintaining it. If you encounter any issues, please don't hesitate to reach out.

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

[](#installation)

You can install the package into a `Laravel` app that uses [Nova](https://nova.laravel.com) via composer:

```
composer require marshmallow/nova-global-filter
```

The card is registered automatically through Laravel package auto-discovery, so there are no extra setup steps.

Usage
-----

[](#usage)

In this example, we are registering a few `Metric Cards` and the `Global Filter` with a `Date` filter as:

```
...
use Marshmallow\NovaGlobalFilter\NovaGlobalFilter;
use App\Nova\Filters\Date;

class Store extends Resource
{
  ...
  public function cards(Request $request)
  {
    return [
      new TotalSales, // Value Metric

      new Orders, // Trend Metric

      new MostSoldProduct, // Partition Metric

      // NovaGlobalFilter
      new NovaGlobalFilter([
        new Date, // Date Filter
      ]),
    ];
  }
  ...
}
```

And now `metric cards` or any `other cards` optimized to listen to `GlobalFilter` can be filtered by using the `GlobalFilterable` trait and calling the `$this->globalFiltered($request, $model, $filters)` method.

The `globalFiltered($request, $model, $filters = [])` method expects the `$request`, `$model` and `$filters` parameters:

```
use Marshmallow\NovaGlobalFilter\GlobalFilterable;
use App\Nova\Filters\Date;
...

class UsersPerDay extends Trend
{
  use GlobalFilterable;

  public function calculate(NovaRequest $request)
  {
    // Filter your model with existing filters
    $model = $this->globalFiltered($request, Store::class, [
      Date::class // DateFilter
    ]);

    // Do your thing with the filtered $model
    return $this->countByDays($request, $model);
  }
...
}
```

And that's it. Cards will be filtered based on the passed filter value.

If you want to apply a default value on the initial request, make sure you set the default value in your filter as:

```
...
// set default date
public function default()
{
    return Carbon::now();
}
...
```

To change the layout from `grid` to `inline`

*by default it's set to `grid`*

[![screenshot](resources/gifs/inline-reset-view.png)](resources/gifs/inline-reset-view.png)

```
...
(new NovaGlobalFilter([
    // Filters
]))->inline(),
...
```

To enable the `Reset` button:

```
...
(new NovaGlobalFilter([
    // Filters
]))->resettable(),
...
```

To add multiple `Global Filter`s:

```
...
(new NovaGlobalFilter([
    // Filters
]))->inline()->resettable(),

(new NovaGlobalFilter([
    // Filters
]))->onlyOnDetail(),
...
```

To set the card width (`1/3`, `1/2`, or `full` — defaults to `full`):

```
...
(new NovaGlobalFilter([
    // Filters
]))->width('1/2'),
...
```

To listen to the `Global Filter` on any `Custom Card`s:

```
...
created() {
  Nova.$on("global-filter-changed", filter => {
    // Do your thing with the changed filter
    console.log(filter);
  });
},
...
```

To request all filter states from the `Global Filter` on any `Custom Card`s:

```
...
  Nova.$emit("global-filter-request");
...
```

To request specific filter states from the `Global Filter` on any `Custom Card`s:

```
...
created() {
  Nova.$emit("global-filter-request", [
      "App\\Nova\\Filters\\DateFilter",
      "App\\Nova\\Filters\\CountryFilter"
  ]);
},
...
```

To receive filter states from the `Global Filter` on any `Custom Card`s:

```
...
created() {
  Nova.$on("global-filter-response", filters => {
    // Do your thing with the filters
    console.log(filters);
  });
},
...
```

Good to know
------------

[](#good-to-know)

- The basic functionality of this package is that it listens to all the assigned filters. Once the value of a filter is changed, it emits `Nova.$on('global-filter-changed', [changed filter and value])`. So any card that listens to this event will receive the filter and its value.
- This package overwrites Nova's default `Metric Card`s to allow them to listen to the `"global-filter-changed"` event. Make sure there are no conflicts with other packages.
- This package currently does not support Index view filters to be synchronized. So filters in the `Global Filter` will not trigger an update of the filters in the `Filter Menu` of your Index view.
- The `Reset` button simply reloads the current page. There is nothing fancy going on behind the scenes.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please report security vulnerabilities by email rather than via the public issue tracker.

Credits
-------

[](#credits)

This package is maintained by [Marshmallow](https://marshmallow.dev). It builds on the original work of:

- [Nemrut Creative Studio](https://nemrut.co)
- [Muzaffer Dede](https://github.com/muzafferdede)
- [nemrutco/nova-global-filter](https://github.com/nemrutco/nova-global-filter)
- [All Contributors](https://github.com/marshmallow-packages/nova-global-filter/contributors)

Made with ❤️ for open source.

License
-------

[](#license)

The MIT License (MIT). Please see the [License File](LICENSE.md) for more information.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance77

Regular maintenance activity

Popularity18

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 54.5% 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 ~113 days

Total

3

Last Release

316d ago

Major Versions

v3.0.0.x-dev → v5.0.02025-08-21

PHP version history (2 changes)v3.0.0PHP ^8.0

v5.0.0PHP ^8.1

### Community

Maintainers

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

---

Top Contributors

[![LTKort](https://avatars.githubusercontent.com/u/2412670?v=4)](https://github.com/LTKort "LTKort (6 commits)")[![stefvanesch](https://avatars.githubusercontent.com/u/46725619?v=4)](https://github.com/stefvanesch "stefvanesch (5 commits)")

---

Tags

laravelMetricsdashboardcardfiltersnova

### Embed Badge

![Health badge](/badges/marshmallow-nova-global-filter/health.svg)

```
[![Health](https://phpackages.com/badges/marshmallow-nova-global-filter/health.svg)](https://phpackages.com/packages/marshmallow-nova-global-filter)
```

###  Alternatives

[digital-creative/nova-dashboard

The missing dashboard for nova.

7171.8k1](/packages/digital-creative-nova-dashboard)[jubeki/nova-card-linkable

A Linkeable Card for the Laravel Nova Dashboard.

19277.1k](/packages/jubeki-nova-card-linkable)[square1/nova-metrics

Add support for resource-filters on your laravel nova metrics

27284.4k](/packages/square1-nova-metrics)

PHPackages © 2026

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