{"id":36970187,"url":"https://github.com/mcklayin/query-filter","last_synced_at":"2026-01-13T21:45:33.910Z","repository":{"id":62526182,"uuid":"134623053","full_name":"mcklayin/query-filter","owner":"mcklayin","description":null,"archived":false,"fork":false,"pushed_at":"2019-12-29T16:40:17.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-21T22:56:01.432Z","etag":null,"topics":["laravel","queryfilter"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mcklayin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-23T20:39:28.000Z","updated_at":"2019-12-29T16:40:19.000Z","dependencies_parsed_at":"2022-11-02T14:16:11.647Z","dependency_job_id":null,"html_url":"https://github.com/mcklayin/query-filter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mcklayin/query-filter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcklayin%2Fquery-filter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcklayin%2Fquery-filter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcklayin%2Fquery-filter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcklayin%2Fquery-filter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcklayin","download_url":"https://codeload.github.com/mcklayin/query-filter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcklayin%2Fquery-filter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28401058,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["laravel","queryfilter"],"created_at":"2026-01-13T21:45:33.117Z","updated_at":"2026-01-13T21:45:33.905Z","avatar_url":"https://github.com/mcklayin.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# QueryFilter\n\nEasily create filters for your Eloquent model.\n\nBased on [Jeffray Way's Laracast tutorial](https://github.com/laracasts/Dedicated-Query-String-Filtering/).\n\n## Installation\n\nThe library is currently not available on Composer, so you have to declare it manually in your `composer.json`.\n\nTo do this, add the following in your `composer.json` :\n\n```json\n{\n    \"require\" : {\n        \"mcklayin/query-filter\": \"dev-master\"\n    },\n    \"repositories\": [\n        {\n            \"type\": \"vcs\",\n            \"url\": \"https://github.com/mcklayin/query-filter\"\n        }\n    ]\n}\n```\n\nOr type in console:\ncomposer require \"mcklayin/query-filter @dev\"\n\n## Usage\n\n- Create your model filters, for exemple in a `App\\Http\\Filters` namespace :\n\n```php\n\u003c?php\n\nnamespace App\\Http\\Filters;\n\nuse McklayiN\\QueryFilter\\QueryFilter;\n\nclass MyModelFilter extends QueryFilter\n{\n    public function foo($value)\n    {\n        return $this-\u003ebuilder-\u003ewhere('foo', 'bar');\n        //or\n        //return $this-\u003ewhere('foo', 'bar');\n    }\n}\n```\n\n- Then, add the `FilterableTrait` on your model to allow the use of `MyModel::filter()` :\n\n```php\n\u003c?php\n\nnamespace App;\n\nuse Illuminate\\Database\\Eloquent\\Model;\nuse McklayiN\\QueryFilter\\Traits\\FilterableTrait;\n\nclass MyClass extends Model\n{\n    use FilterableTrait;\n}\n```\n\n- Finally, you can use the `MyModel::filter()` method in your controller :\n\n```php\n\u003c?php\n\nnamespace App\\Http\\Controllers;\n\nuse App\\Http\\Filters\\MyModelFilter;\nuse App\\MyModel;\n\nclass MyController extends Controller\n{\n    public function index(MyModelFilter $filter)\n    {\n        $data = MyModel::filter($filter)-\u003eget();\n\n        return response()-\u003ejson(compact('data'));\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcklayin%2Fquery-filter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcklayin%2Fquery-filter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcklayin%2Fquery-filter/lists"}