Skip to content

Laravel Package that provides filters for Eloquent Models

Notifications You must be signed in to change notification settings

gkalmoukis/laravel-filters

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

laravel-filters

Install

Via composer

composer require gkalmoukis/laravel-filters

Usage

Create filter class

php artisan make:filter <filter-name> --model=<model>

Write your query in handle() method in app\Filters\<model>\<filter-name>

must exists as column in the model database table.

Add the trait

In your model import the FilterByTrait in scope.

use Gkalmoukis\LaravelFilters\Traits\FilterByTrait;

and use it

use FilterByTrait;

Filter results

$filters = request()->all();
$results = Model::filterBy($filters)->get();

About

Laravel Package that provides filters for Eloquent Models

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages