PHPackages                             huuloc4193/nova-range-input-filter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Search &amp; Filtering](/categories/search)
4. /
5. huuloc4193/nova-range-input-filter

ActiveLibrary[Search &amp; Filtering](/categories/search)

huuloc4193/nova-range-input-filter
==================================

A Laravel Nova range input filter.

1.1.1(3mo ago)03MITVuePHP &gt;=8.1

Since Jan 22Pushed 3mo agoCompare

[ Source](https://github.com/huuloc4193/nova-range-input-filter)[ Packagist](https://packagist.org/packages/huuloc4193/nova-range-input-filter)[ RSS](/packages/huuloc4193-nova-range-input-filter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Nova Range Input Filter
=======================

[](#nova-range-input-filter)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c51b7db541ee8169c252acabb490c32e78763a5ca261a127453a7a2d3b2a8e38/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6469676974616c2d63726561746976652f6e6f76612d72616e67652d696e7075742d66696c746572)](https://packagist.org/packages/digital-creative/nova-range-input-filter)[![Total Downloads](https://camo.githubusercontent.com/c4d4dcfbaaf605cefe9d0aaea52a4a52412818ebc813f4d5e0933f300945564a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6469676974616c2d63726561746976652f6e6f76612d72616e67652d696e7075742d66696c746572)](https://packagist.org/packages/digital-creative/nova-range-input-filter)[![License](https://camo.githubusercontent.com/78634163dd7e4155f32534573794256c9ed201f90ef663f0a5f5b1589322f7c2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6469676974616c2d63726561746976652f6e6f76612d72616e67652d696e7075742d66696c746572)](https://github.com/dcasia/nova-range-input-filter/blob/main/LICENSE)

A Laravel Nova range input filter.

  ![RangeInputFilter in Action](https://raw.githubusercontent.com/dcasia/nova-range-input-filter/main/screenshots/light.png)Installation
============

[](#installation)

You can install the package via composer:

```
composer require huuloc4193/nova-range-input-filter

```

Basic Usage
-----------

[](#basic-usage)

Create a filter as usual and extend the `DigitalCreative\RangeInputFilter\RangeInputFilter` class

```
use DigitalCreative\RangeInputFilter\RangeInputFilter;

class MyFilter extends RangeInputFilter {

    public function apply(NovaRequest $request, $query, $value)
    {
        $from = data_get($value, 'from');
        $to = data_get($value, 'to');

        return $query->where(function ($q) use ($from, $to) {
                    if ($from) {
                        $q->where('id', '>=', $from);
                    }
                    if ($to) {
                        $q->where('id', '
