A Nova macro that streamlines setting a default value in addition to enabling filtering functionality on a field.
javii-script/default-value-filterable is a Laravel package for a nova macro that streamlines setting a default value in addition to enabling filtering functionality on a field..
It currently has 2 GitHub stars and 15.608 downloads on Packagist (latest version 2.0.0).
Install it with composer require javii-script/default-value-filterable.
Discover more Laravel packages by javii-script
or browse all Laravel packages to compare alternatives.
Last updated
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.

To use this package, ensure your environment meets the following requirements:
^8.1^5.0Install the package via Composer:
composer require javii-script/default-value-filterable
The defaultFilterable macro makes it easy to define a default value for filters, enhancing the functionality of your Nova resources.
Text::make('Name')
->defaultFilterable(function () {
return 'John Doe';
}),
In this example, the Name field will have a default filter value of John Doe.
Text::make('Name')
->defaultFilterable(function () {
return 'John Doe';
}, function ($request, $query, $value, $attribute) {
$query->where($attribute, 'LIKE', "{$value}%");
}),
In this example:
Contributions are welcome! If you have ideas for improvements or find any issues, feel free to open an issue or submit a pull request.
This package is open-sourced software licensed under the MIT license.