https://github.com/catalyzecomm/laravel-filterable
This package allows you to easily handle database filtering through query strings.
https://github.com/catalyzecomm/laravel-filterable
catalyzecomm filterable laravel
Last synced: 2 months ago
JSON representation
This package allows you to easily handle database filtering through query strings.
- Host: GitHub
- URL: https://github.com/catalyzecomm/laravel-filterable
- Owner: catalyzecomm
- License: mit
- Created: 2020-09-22T22:35:54.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-06-07T06:47:47.000Z (about 5 years ago)
- Last Synced: 2025-12-14T12:40:53.065Z (7 months ago)
- Topics: catalyzecomm, filterable, laravel
- Language: PHP
- Homepage:
- Size: 28.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Laravel Filterable
[](https://github.styleci.io/repos/297788666?branch=master)
[](//packagist.org/packages/catalyzecomm/laravel-filterable)
[](//packagist.org/packages/catalyzecomm/laravel-filterable)
[](//packagist.org/packages/catalyzecomm/laravel-filterable)
This package allows you to easily handle database filtering through query strings.
## Installation
You can install the package via composer:
for Laravel 6.x & 7.x
```bash
composer require catalyzecomm/laravel-filterable
```
## Introduction
Introduction here
### Usage
Define your model (use `Catalyzecomm\Filterable` Trait and define `$allowedFilters`)
```php
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
```php
$users = User::filterPaginate();
```
or
```php
$users = User::filterAll();
```
## Credits
- [catalyzecomm](https://github.com/catalyzecomm)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.