xidanko / query-filter
Elegant full featured query filter for laravel.
Installs: 150
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/xidanko/query-filter
Requires
- php: >=7.4
README
Installation
composer require xidanko/query-filter
Laravel will discover package service provider automatically
Basic Usage
First you have to add XiDanko\QueryFilter\HasFilter trait to the desired model.
This will register useFilter local scope to your model.
Now create new filter using this artisan command
php artisan make:filter <name>
This will create a new filter class in App\Filters directory, there you can define all your filter methods.
Example
After using the trait in your desired model and creating the filter class you can hype hint your class in any controller method:
public function index(Filter $yourFilterClass) { return User::useFilter($yourFilterClass)->get(); }