A simple and customizable price filter for FilamentPHP, allowing users to easily refine results based on specified price ranges.
MIT License
A simple and customizable price filter for FilamentPHP, allowing users to easily refine results based on specified price ranges.
You can install the package via composer:
composer require codewithdennis/filament-price-filter
You can publish the config file with:
php artisan vendor:publish --tag="filament-price-filter-config"
This is the contents of the published config file:
<?php
return [
'currency' => 'USD',
'cents' => true,
'column' => 'price'
];
By default, the column that the filter will use is price
, but you can change it to any column you want.
PriceFilter::make()
->currency(column: 'total_price')
By default, the currency is set to USD globally, but you can change it per filter to any currency you want.
PriceFilter::make()
->currency(currency: 'EUR')
The filter will use the locale that is used in the application config('app.locale')
, but you can also set a custom locale.
PriceFilter::make()
->currency(currency: 'EUR', locale: 'NL'),
A good practice is to save your currency as cents but if you saved it as a whole number you can disable the cents.
PriceFilter::make()
->currency(currency: 'EUR', locale: 'NL', cents: false),
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.