PHP code example of digital-creative / nova-pill-filter

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

    

digital-creative / nova-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(NovaRequest $request): array
    {
        return [
           'Display Text 1' => 'value-1',
           'Display Text 2' => 'value-2'
        ];
    }

}

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()->single()
        ];
    }

}

class ExampleNovaResource extends Resource {

    public function filters(NovaRequest $request): array
    {
        return [
            MyFilter::make()->dragMode(),
            MyFilter::make()->stackMode(),
            MyFilter::make()->wrapMode(),
        ];
    }

}