A Laravel Nova filter for picking range between a min/max value.
You can install the package via composer:
composer require digital-creative/nova-slider-filter
Create a filter as usual and extend the DigitalCreative\SliderFilter\SliderFilter
class
use DigitalCreative\SliderFilter\SliderFilter;
class MyFilter extends SliderFilter {
public function apply(Request $request, $query, $values)
{
[ $min, $max ] = $values;
}
}
and use it as usual on the filters methods within your resource class:
class ExampleNovaResource extends Resource {
public function filters(Request $request)
{
return [
new MyFilter()
];
}
}
You can configure the min/max values as well as the tooltip suffix by calling:
class ExampleNovaResource extends Resource {
public function filters(Request $request)
{
return [
(new MyFilter())->minValue(0)
->maxValue(1000)
->label('$')
];
}
}
The MIT License (MIT). Please see License File for more information.