PHP code example of codicastudio / range-filter

1. Go to this page and download the library: Download codicastudio/range-filter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

codicastudio / range-filter example snippets


use DigitalCreative\RangeInputFilter\RangeInputFilter;

class MyFilter extends RangeInputFilter {

    public function apply(Request $request, $query, $value)
    {
        // $value will always be [ "from" => ?, "to" => ? ]
    }
    
    public function options(Request $request) : array
    {
        return [
            'fromPlaceholder' => 0,
            'toPlaceholder' => 20,
            'dividerLabel' => 'to',
        ];
    }

}

class ExampleNovaResource extends Resource {

    public function filters(Request $request)
    {
        return [
            new MyFilter()
        ];
    }

}