Skip to content

michelangelomo/easyfilter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Easy Filter

EasyFilter helps you to filter eloquent queries

Requirements

Installation

composer require michelangelomo/easyfilter

Usage

use Michelangelo\EasyFilter\EasyFilter;
$filter = new EasyFilter($query);
$filter->orderByDesc('id');

$filter->whereLike('name', 'giovanni', '%', '%');

$filter->whereHasEquals('roles', 'name', 'admin');

//and other methods...

Example

//Get some users
$users = User::where('company', 'Antani Inc.');
//Instantiating class
$filter = new EasyFilter($users);
$filter->whereCustom('id', '>=', 6); 
$filter->whereNotEquals('name', 'John');
$filter->whereHasEquals('roles', 'id', 1);
$filter->whereHasNotEquals('roles', 'id', 4);
//and so on
//....
//Finally get filtered users
$users->get();

About

EasyFilter helps you to filter eloquent queries

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages