PHP code example of codicastudio / pill-filter

1. Go to this page and download the library: Download codicastudio/pill-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 / pill-filter example snippets


use DigitalCreative\PillFilter\PillFilter;

class MyFilter extends PillFilter {

    public function apply(Request $request, $query, $values)
    {
        // $values will always be an array
    }
    
    public function options(Request $request)
    {
        return [
           'Display Text 1' => 'value-1',
           'Display Text 2' => 'value-2'
        ];
    }

}

class ExampleNovaResource extends Resource {

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

}

class ExampleNovaResource extends Resource {

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

}

class ExampleNovaResource extends Resource {

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

}