Skip to content

This package allows you to easily handle database filtering through query strings.

License

Notifications You must be signed in to change notification settings

catalyzecomm/laravel-filterable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Filterable

StyleCI Latest Stable Version License Total Downloads

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

composer require catalyzecomm/laravel-filterable

Introduction

Introduction here

Usage

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

Credits

License

The MIT License (MIT). Please see License File for more information.

About

This package allows you to easily handle database filtering through query strings.

Topics

Resources

License

Stars

Watchers

Forks

Languages