LaravelPackages.net
Acme Inc.
Toggle sidebar
xidanko/query-filter

Elegant full featured query filter for laravel.

207
1
v1.0.3
About xidanko/query-filter

xidanko/query-filter is a Laravel package for elegant full featured query filter for laravel.. It currently has 1 GitHub stars and 207 downloads on Packagist (latest version v1.0.3). Install it with composer require xidanko/query-filter. Discover more Laravel packages by xidanko or browse all Laravel packages to compare alternatives.

Last updated

Laravel Query Filter

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