PHP code example of optimistdigital / nova-input-filter

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

    

optimistdigital / nova-input-filter example snippets


use Outl1ne\NovaInputFilter\InputFilter;
use Laravel\Nova\Http\Requests\NovaRequest;

// ..

public function filters(NovaRequest $request): array
{
    return [
        InputFilter::make()->forColumns(['email'])->withName('Email'),

        // Or

        InputFilter::make(['email'], 'email'),
    ];
}


use Outl1ne\NovaInputFilter\InputFilter;
use Illuminate\Contracts\Database\Eloquent\Builder;
use Laravel\Nova\Http\Requests\NovaRequest;

class ExtendedInputFilter extends InputFilter
{
    public function apply(NovaRequest $request, Builder $query, mixed $value)
    {
        return $query->where('email', 'like', "%$value%");
    }
}