PHPackages                             javii-script/default-value-filterable - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. javii-script/default-value-filterable

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

javii-script/default-value-filterable
=====================================

A Nova macro that streamlines setting a default value in addition to enabling filtering functionality on a field.

2.0.0(1y ago)212.1k↓27%MITPHPPHP ^8.1

Since Sep 26Pushed 1y ago1 watchersCompare

[ Source](https://github.com/JaviiScript/default-value-filterable)[ Packagist](https://packagist.org/packages/javii-script/default-value-filterable)[ RSS](/packages/javii-script-default-value-filterable/feed)WikiDiscussions main Synced 1mo ago

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

Nova Field Default Filter Macro
===============================

[](#nova-field-default-filter-macro)

[![Latest Version on Packagist](https://camo.githubusercontent.com/4ddbac4b7cc98d642f63ff6a8584d56337051e785983d4eb40183bb2c54adf3b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a617669692d7363726970742f64656661756c742d76616c75652d66696c74657261626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/javii-script/default-value-filterable)[![Total Downloads](https://camo.githubusercontent.com/08ddf885437a46c5264859a7e5ee56a7f0cde3562d3291609a94dd145296bcd5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a617669692d7363726970742f64656661756c742d76616c75652d66696c74657261626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/javii-script/default-value-filterable)

Nova Field Default Filter Macro is a custom macro for **Laravel Nova** that simplifies the process of setting default values and enabling filtering capabilities for fields.

---

Features
--------

[](#features)

- **Default Value for Filters:** Easily set default values for fields when filters are applied.
- **Customizable Filtering Logic:** Define how the filtering is applied with custom callback functions.
- **Seamless Integration:** Designed specifically for Laravel Nova resources.

---

Screenshot
----------

[](#screenshot)

[![Nova Field Default Filter Macro Example](https://raw.githubusercontent.com/JaviiScript/default-value-filterable/main/docs/user-resource.png)](https://raw.githubusercontent.com/JaviiScript/default-value-filterable/main/docs/user-resource.png)

---

Requirements
------------

[](#requirements)

To use this package, ensure your environment meets the following requirements:

- PHP: `^8.1`
- Laravel Nova: `^5.0`

---

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

[](#installation)

Install the package via Composer:

```
composer require javii-script/default-value-filterable
```

Usage
-----

[](#usage)

The defaultFilterable macro makes it easy to define a default value for filters, enhancing the functionality of your Nova resources.

Basic Example
-------------

[](#basic-example)

```
Text::make('Name')
    ->defaultFilterable(function () {
        return 'John Doe';
    }),
```

In this example, the Name field will have a default filter value of John Doe.

Advanced Example with Custom Filtering Logic
--------------------------------------------

[](#advanced-example-with-custom-filtering-logic)

```
Text::make('Name')
    ->defaultFilterable(function () {
        return 'John Doe';
    }, function ($request, $query, $value, $attribute) {
        $query->where($attribute, 'LIKE', "{$value}%");
    }),
```

In this example:

1. **Default Value:** The Name field will default to John Doe when filtering.
2. **Custom Filtering:** The filtering logic will apply a LIKE clause to match records where the Name starts with the filter value.

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

[](#contributing)

Contributions are welcome! If you have ideas for improvements or find any issues, feel free to open an issue or submit a pull request.

License
-------

[](#license)

This package is open-sourced software licensed under the MIT license.

Links
-----

[](#links)

- [Packagist](https://packagist.org/packages/javii-script/default-value-filterable)
- [GitHub Repository](https://github.com/JaviiScript/default-value-filterable)

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance41

Moderate activity, may be stable

Popularity29

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Total

2

Last Release

490d ago

Major Versions

1.0.0 → 2.0.02025-01-13

PHP version history (2 changes)1.0.0PHP ^7.3|^8.0

2.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/1c1daf87cef605c2d5439daec3f79f2480a373cb69174b5c343a88513700d253?d=identicon)[JaviiScript](/maintainers/JaviiScript)

---

Top Contributors

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

---

Tags

laravelmacronovajavii-script

### Embed Badge

![Health badge](/badges/javii-script-default-value-filterable/health.svg)

```
[![Health](https://phpackages.com/badges/javii-script-default-value-filterable/health.svg)](https://phpackages.com/packages/javii-script-default-value-filterable)
```

###  Alternatives

[optimistdigital/nova-sortable

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag &amp; drop.

2872.1M6](/packages/optimistdigital-nova-sortable)[outl1ne/nova-sortable

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag &amp; drop.

2861.8M9](/packages/outl1ne-nova-sortable)[optimistdigital/nova-multiselect-field

A multiple select field for Laravel Nova.

3403.5M7](/packages/optimistdigital-nova-multiselect-field)[digital-creative/conditional-container

Provides an easy way to conditionally show and hide fields in your Nova resources.

116593.8k4](/packages/digital-creative-conditional-container)[sbine/route-viewer

A Laravel Nova tool to view your registered routes.

57215.9k](/packages/sbine-route-viewer)[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

14720.0k](/packages/markwalet-nova-modal-response)

PHPackages © 2026

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