Download the PHP package stephenjude/simple-query-filter without Composer
On this page you can find all versions of the php package stephenjude/simple-query-filter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download stephenjude/simple-query-filter
More information about stephenjude/simple-query-filter
Files in stephenjude/simple-query-filter
Package simple-query-filter
Short Description Easily filter eloquent model queries from HTTP requests
License MIT
Homepage https://github.com/stephenjude/simple-query-filter
Informations about the package simple-query-filter
Deprecation Notice
This package is abandoned and no longer maintained. Consider using the spatie/laravel-query-builder package instead.
Simple Query Filter
This package allows you to filter eloquent model queries based on HTTP request.
Installation
You can install the package via composer:
Usage
Add the WithQueryFilter
trait to your searchable model:
Filter a model based on a request: /posts?column_name=search_string:
The filter()
method is used to filter the rows in a table. The result will only include rows that meets all the criteria of the query parameters.
Search a model based on a request: /posts?column_name=search_string:
The scout()
method is used to perform a full search on the model. The result for this method includes any row that meets the search criteria.
Custom Query Parameters
You can alternatively pass an array of column names and search strings as a key-value pair to the filter method:
Column Not Found Exception
The eloquent filter scope provided in this package will throw a bad request HTTP exception if it fails to find any of the specified column names.
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Stephen Jude
- All Contributors
License
The MIT License (MIT). Please see License File for more information.