Filament Filter is a Laravel package that provides a simple and elegant way to add filters to your Filament admin panel. With Filament Filter, you can easily create filters that allow your users to search, sort, and filter your data based on specific criteria.
You can install the package via composer:
composer require creative2llc/filament-filter
To add the filter to your Filament Resource, navigate to the ListRecords
class you are extending, and include the 'HasFilamentFilter' trait. Also make sure to include the getColumnsProperty()
method, which will return an array of columns that you want to be searchable. The key of the array will be the database column name, and the value will be the user facing column name.
class ListPosts extends ListRecords
{
use HasFilamentFilter;
protected static string $resource = Post::class;
public function getColumnsProperty(): array
{
return [
'database_column' => 'User Facing Column Name',
];
}
}
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.