rosamarsky / nova-range-filter
A Laravel Nova range filter.
Installs: 10 409
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 0
Open Issues: 2
Language:Vue
Requires
- php: >=8.1
- laravel/nova: ^4.0
This package is auto-updated.
Last update: 2024-10-29 06:00:29 UTC
README
A Laravel Nova filter for picking range between a min/max value. This package based on vue-slider-component.
Requirements
php
:>=8.1
laravel/nova
:^4.0
Installation
You can install the package via composer:
composer require rosamarsky/nova-range-filter
Usage
Use it as usual on the filters methods within your resource class:
use Rosamarsky\RangeFilter\RangeFilter; use App\Models\Invoice as InvoiceModel; class Invoice extends Resource { public function filters(Request $request) { return [ RangeFilter::make('Amount', 'amount', [ 'min' => floor(InvoiceModel::query()->min()), 'max' => ceil(InvoiceModel::query()->max()), 'interval' => 10, ]), ]; } }
The interval value must be greater than 0 and can be divisible by (max - min).
You also can provide next options:
tooltip
- control tooltip display. Defaultactive
.none
- never display;always
- always display;hover
- display when the slider get hover;focus
- display when the slider has focus;active
- display when tooltip have both hover and focus.
minRange
,maxRange
- minimum and maximum distance between sliders.clickable
- allow changes to value by clicking. Default -true
;disabled
- enable/disable the component. Default -true
;label
- the postfix of displayed values for marks and tooltips.
License
The MIT License (MIT). Please see License File for more information.