catalyzecomm/laravel-filterable is a Laravel package for a simple filter library for laravel.
It currently has 1 GitHub stars and 22 downloads on Packagist (latest version v1.0.1).
Install it with composer require catalyzecomm/laravel-filterable.
Discover more Laravel packages by catalyzecomm
or browse all Laravel packages to compare alternatives.
Last updated
This package allows you to easily handle database filtering through query strings.
You can install the package via composer:
for Laravel 6.x & 7.x
composer require catalyzecomm/laravel-filterable
Introduction here
Define your model (use Catalyzecomm\Filterable Trait and define $allowedFilters)
use Catalyzecomm\Filterable;
...
/**
* Define an array of filter that allowed to use for this model
* `key` as class name and `value` as field name(s)
*
* @var array
*/
protected static $allowedFilters = [
Catalyzecomm\Filters\Sort::class => 'created_at',
Catalyzecomm\Filters\Keywords::class => 'name,email',
];
Use on your controller
$users = User::filterPaginate();
or
$users = User::filterAll();
The MIT License (MIT). Please see License File for more information.