PHP code example of digital-creative / nova-range-input-filter

1. Go to this page and download the library: Download digital-creative/nova-range-input-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/ */

    

digital-creative / nova-range-input-filter example snippets


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

}

class ExampleNovaResource extends Resource {

    public function filters(NovaRequest $request): array
    {
        return [
            MyFilter::make()
        ];
    }

}

class ExampleNovaResource extends Resource {

    public function filters(NovaRequest $request): array
    {
        return [
            MyFilter::make()
                ->dividerLabel('<>') // control the divider label in between the inputs
                ->inputType('week') // supports any html input type
                ->placeholder('From', 'To') // control the placeholder of the inputs
                ->fromAttributes([ 'min' => 0 ]) // some inputs type like number accepts more attributes like min/max/step etc..
                ->toAttributes([ 'max' => 100 ]) 
        ];
    }

}