outl1ne / nova-input-filter
An input filter for Laravel Nova
Installs: 274 310
Dependents: 0
Suggesters: 0
Security: 0
Stars: 23
Watchers: 6
Forks: 17
Open Issues: 0
Requires
- php: >=8.0
- laravel/nova: ^4.0
README
This Laravel Nova package allows you to create simple input filters.
Requirements
php: >=8.0
laravel/nova: ^4.0
Features
- Out of the box, works like an additional search field.
- Inline usage for simple use-cases.
Screenshots
Installation
Install the package in to a Laravel app that uses Nova via composer:
composer require outl1ne/nova-input-filter
Usage
Accepts an array of columns as first parameter and filter name as second parameter. Can optionally pass in multiple
columns: ['email', 'id']
, similarly to nova's search.
use Outl1ne\NovaInputFilter\InputFilter; public function filters(Request $request) { return [ InputFilter::make()->forColumns(['email'])->withName('Email'), // Or InputFilter::make(['email'], 'email'), ]; }
Customizing
Out of the box, InputFilter
works exactly like Nova's search field. If you wish to change it, you can extend
the InputFilter
class and override apply()
function.
use Outl1ne\NovaInputFilter\InputFilter; class ExtendedInputFilter extends InputFilter { public function apply(Request $request, $query, $search) { return $query->where('email', 'like', "%$search%"); } }
Credits
License
Nova Input Filter is open-sourced software licensed under the MIT license.