/nova-slider-filter

A Laravel Nova filter for picking range between a min/max value.

Primary LanguageVueMIT LicenseMIT

Nova Slider Filter

Latest Version on Packagist Total Downloads License

A Laravel Nova filter for picking range between a min/max value.

SliderFilter in Action

Installation

You can install the package via composer:

composer require digital-creative/nova-slider-filter

Basic Usage

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('$')
        ];
    }

}

License

The MIT License (MIT). Please see License File for more information.