PHPackages                             eth0/laravel-filters - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Search &amp; Filtering](/categories/search)
4. /
5. eth0/laravel-filters

ActivePackage[Search &amp; Filtering](/categories/search)

eth0/laravel-filters
====================

A clean laravel model filters where we can filter laravel models by passing query string into it.

v1.1.0(4y ago)59881MITPHPPHP ^7.2|^8.0

Since Dec 7Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Erth0/laravel-model-filters)[ Packagist](https://packagist.org/packages/eth0/laravel-filters)[ RSS](/packages/eth0-laravel-filters/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (13)Used By (0)

Laravel Model Filters
=====================

[](#laravel-model-filters)

### An clean way of filtering laravel models by query strings.

[](#an-clean-way-of-filtering-laravel-models-by-query-strings)

[![GitHub issues](https://camo.githubusercontent.com/9cb6a70e524616e4a03cc92709b84ceda599dd896a16135ccafaaa3572187c7b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f45727468302f6c61726176656c2d6d6f64656c2d66696c746572732e737667)](https://github.com/Erth0/laravel-model-filters/issues)[![GitHub forks](https://camo.githubusercontent.com/bd93007960592538c8fcaaec35d4e2353338240d09e5a9b0dacba0847abfb362/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f45727468302f6c61726176656c2d6d6f64656c2d66696c746572732e737667)](https://github.com/Erth0/laravel-model-filters/network)[![GitHub stars](https://camo.githubusercontent.com/82971732aa86b5c33a6b0e303277a900833e34bc18565f8f073a4444a020a71a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f45727468302f6c61726176656c2d6d6f64656c2d66696c746572732e737667)](https://github.com/Erth0/laravel-model-filters/stargazers)[![GitHub license](https://camo.githubusercontent.com/dd938f03a466dfe502263a2b05452bf41f3b8f8394cf1f0d7b07af8aee9280b8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f45727468302f6c61726176656c2d6d6f64656c2d66696c746572732e737667)](https://github.com/Erth0/laravel-model-filters/blob/master/LICENCE.md)[![Twitter](https://camo.githubusercontent.com/2e6d2256861c3efe914236845279c6ba0d9456e890517e7426297cc3606ca2d2/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f75726c2f68747470732f6769746875622e636f6d2f45727468302f6c61726176656c2d6d6f64656c2d66696c746572732e7376673f7374796c653d736f6369616c)](https://twitter.com/intent/tweet?text=Wow:&url=https%3A%2F%2Fgithub.com%2FErth0%2Flaravel-model-filters)

Installation
------------

[](#installation)

You can install this package via composer using this command:

```
composer require eth0/laravel-filters
```

The package will automatically register itself, but if your laravel versions is &lt; 5.5 you will need to add ` Mukja\LaravelFilters\LaravelFiltersServiceProvider::class,`service provider under your `config/app.php` file.

Documentation
-------------

[](#documentation)

Once the package is installed there will be 2 new artisan commands.

- `php artisan make:filter`
- `php artisan make:model:filter`

We can then generate a new model filter just by typing `php artisan make:filter ModelFilter` this will generate a new php file under `app/Filters/` folder with the name `ModelFilter.php` which will look like below.

```
