PHPackages                             khaledgamal/nova-filterable-cards - 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. khaledgamal/nova-filterable-cards

ActiveLibrary

khaledgamal/nova-filterable-cards
=================================

Filterable Metric Cards For Laravel Nova.

1.2.1(5y ago)04[20 PRs](https://github.com/khaledsabbah/nova-filterable-cards/pulls)MITVue

Since May 14Pushed 3y ago1 watchersCompare

[ Source](https://github.com/khaledsabbah/nova-filterable-cards)[ Packagist](https://packagist.org/packages/khaledgamal/nova-filterable-cards)[ RSS](/packages/khaledgamal-nova-filterable-cards/feed)WikiDiscussions master Synced today

READMEChangelog (6)Dependencies (1)Versions (28)Used By (0)

Nova Filterable Metric Cards
============================

[](#nova-filterable-metric-cards)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e52f9a972c3bb10685641a39056d9165507e1869a0b01e261968225b0f3479da/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6265796f6e64636f64652f6e6f76612d66696c74657261626c652d63617264732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/beyondcode/nova-filterable-cards)[![Total Downloads](https://camo.githubusercontent.com/3d1f683f83410a496bbf285772095ba636078e458ba4b696f573ed9de85d2542/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6265796f6e64636f64652f6e6f76612d66696c74657261626c652d63617264732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/beyondcode/nova-filterable-cards)[![Build Status](https://camo.githubusercontent.com/bc553c33c70adf2b80fc5a937d57aa24daf64c28da2ac37ac1cff7089986849d/68747470733a2f2f7472617669732d63692e6f72672f6265796f6e64636f64652f6e6f76612d66696c74657261626c652d63617264732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/beyondcode/nova-filterable-cards)

Add custom filters to your Laravel Nova metrics.

[![screenshot](https://camo.githubusercontent.com/353e43837f50b1baf718e083144200d4b1879aab7e96c18bacd262160c79a7cf/68747470733a2f2f6265796f6e64636f2e64652f6769746875622f6e6f76612d66696c74657261626c652d63617264732f73637265656e73686f742e706e67)](https://camo.githubusercontent.com/353e43837f50b1baf718e083144200d4b1879aab7e96c18bacd262160c79a7cf/68747470733a2f2f6265796f6e64636f2e64652f6769746875622f6e6f76612d66696c74657261626c652d63617264732f73637265656e73686f742e706e67)[![screenshot](https://camo.githubusercontent.com/b16ad3bfe48dad9d3a0d64ccf5fc810371644eb075f0a3d59bd3f0745f67c28b/68747470733a2f2f6265796f6e64636f2e64652f6769746875622f6e6f76612d66696c74657261626c652d63617264732f73637265656e73686f74312e706e67)](https://camo.githubusercontent.com/b16ad3bfe48dad9d3a0d64ccf5fc810371644eb075f0a3d59bd3f0745f67c28b/68747470733a2f2f6265796f6e64636f2e64652f6769746875622f6e6f76612d66696c74657261626c652d63617264732f73637265656e73686f74312e706e67)

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

[](#installation)

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

```
composer require beyondcode/nova-filterable-cards
```

Usage
-----

[](#usage)

To add the filter ability to your Laravel Nova metric cards, you need to add one of the `Filterable` traits to your metrics.

Depending on your metric type, these are the available traits:

- `FilterableValue`
- `FilterableTrend`
- `FilterablePartition`

For example, within your custom Nova value metric card:

```
// in your Nova value metric card class:
import Beyondcode\FilterableCard\FilterableValue;

use FilterableValue;
```

Defining Filters
----------------

[](#defining-filters)

The available filters for your cards can be defined, by adding a new property called `$filters` to your metrics. This must be an array and contains the names of the available filters, as well as the properties for this specific filter.

Example:

```
// in your filterable Nova metric card class:

protected $filters = [
	'Firstname' => [
		'type' => 'text'
	],
	'Status' => [
		'type' => 'select',
		'options' => [
			'all' => 'All',
			'active' => 'Active',
			'inactive' => 'Inactive'
		],
	]
];
```

### Defining Filters Using Define Methods

[](#defining-filters-using-define-methods)

Sometimes you might want to set the available filter options by using a database call, or load them from the configuration. To enable this, you can also define the filter options using a method with the following naming convention: `defineStudlyCaseFilterName`.

So for example, if you want to add and define a custom filter called `User Status`, you can do it like this:

```
// in your filterable Nova metric card class:

protected $filters = [
	'Firstname' => [
		'type' => 'text'
	],
	'User Status'
];

public function defineUserStatus()
{
	return [
		'type' => 'select',
		'options' => [
			'all' => 'All',
			'active' => 'Active',
			'inactive' => 'Inactive'
		],
	];
}
```

### Available Filter Types

[](#available-filter-types)

The available filter types are:

- `select`
- `checkbox`
- `text`
- `email`
- `url`
- `number`

And all other types that can be applied to HTML `` tags.

### Apply The Filter Logic

[](#apply-the-filter-logic)

To define in which way you want to filter your custom metric query, once a user filters it using the modal, you need to define custom filter methods. The naming convention is similar to defining custom filter options. It's `filterStudlyCaseFilterName`.

This method receives a query builder object and the value of the filter input. You can add your own queries to the builder class and modify as you need. Just make sure that you return the query object.

Example:

```
// in your filterable Nova metric card class:

public function filterUserStatus($query, $status)
{
	return $query->where('status', $status);
}
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Marcel Pociot](https://github.com/mpociot)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity66

Established project with proven stability

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 ~0 days

Total

7

Last Release

2187d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/28e51745184ee15a8128f03d36d157f6f3f2aadbe1fccec65b5d20ae614b916c?d=identicon)[khaledsabbah](/maintainers/khaledsabbah)

---

Tags

laravelnova

### Embed Badge

![Health badge](/badges/khaledgamal-nova-filterable-cards/health.svg)

```
[![Health](https://phpackages.com/badges/khaledgamal-nova-filterable-cards/health.svg)](https://phpackages.com/packages/khaledgamal-nova-filterable-cards)
```

###  Alternatives

[optimistdigital/nova-multiselect-field

A multiple select field for Laravel Nova.

3403.5M7](/packages/optimistdigital-nova-multiselect-field)[coreproc/nova-notification-feed

A Laravel Nova package that adds a notification feed in your Nova app.

10149.1k](/packages/coreproc-nova-notification-feed)[inspheric/nova-defaultable

Default values for Nova fields when creating resources and running resource actions.

51174.8k1](/packages/inspheric-nova-defaultable)[cybercog/laravel-nova-ban

A Laravel Nova banning functionality for your application.

40199.8k](/packages/cybercog-laravel-nova-ban)[insenseanalytics/nova-server-monitor

A Laravel Nova tool for Spatie's Server Monitor library.

6546.9k](/packages/insenseanalytics-nova-server-monitor)[datomatic/nova-detached-actions

A Laravel Nova tool to allow for placing actions in the Nova toolbar detached from the checkbox selection mechanism.

11229.2k](/packages/datomatic-nova-detached-actions)

PHPackages © 2026

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