Download the PHP package inovanti-bank/inovanti-advanced-query-filters without Composer
On this page you can find all versions of the php package inovanti-bank/inovanti-advanced-query-filters. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download inovanti-bank/inovanti-advanced-query-filters
More information about inovanti-bank/inovanti-advanced-query-filters
Files in inovanti-bank/inovanti-advanced-query-filters
Package inovanti-advanced-query-filters
Short Description Componente de filtros avançados para Laravel
License MIT
Informations about the package inovanti-advanced-query-filters
Inovanti Advanced Query Filters
Inovanti Advanced Query Filters is a Laravel package that provides an easy and flexible way to apply advanced query filters to your Eloquent queries. It supports various types of filters including date, numeric, string, array, boolean, range, and relation filters.
Installation
To install the package, you can use Composer:
Usage
Basic Usage
You can use the provided filters to apply various types of filters to your Eloquent queries. Here is an example of how to use the FilterService
:
Configuring Filters in Models
You can configure the filters directly in your Eloquent models. This way, the filters will always be available whenever a query is executed on the model.
Example
Example JSON for Filters
Here are examples of the JSON structure that the frontend should send in the body of the request to apply the filters correctly:
Date Filter
Numeric Filter
String Filter
Array Filter
Boolean Filter
Null Filter
Range Filter
Relation Filter
Available Filters
The package supports the following types of filters:
- DateFilter: Filters based on dates.
- NumericFilter: Filters based on numeric values.
- StringFilter: Filters based on string values.
- ArrayFilter: Filters based on arrays.
- BooleanFilter: Filters based on boolean values.
- NullFilter: Filters based on null values.
- RangeFilter: Filters based on numeric ranges.
- RelationFilter: Filters based on relationships between models.
Getting Filter Operator Translations
You can use the FilterService to get the translations of the available filter operators. This is useful for displaying friendly operator names to the end users on the frontend.
Example
Custom Filters
You can also create custom filters by implementing the FilterInterface. Here is an example:
Registering Custom Filters
All types of operators are available in FilterOperatorEnum
Registering Custom Filters
Once you have created a custom filter, you can register it with the FilterService
:
Testing
The package comes with unit and feature tests to ensure everything works as expected. You can run the tests using PHPUnit:
To run unit tests:
To run feature tests:
Contribution
Feel free to contribute to this package by submitting pull requests or opening issues. We appreciate your feedback and help in improving the package.
- Fork the repository.
- Create a new branch.
- Submit a pull request.
License
This package is open-source software licensed under the MIT license.
Thank you for using Inovanti Advanced Query Filters! If you have any questions or need further assistance, please don't hesitate to reach out [email protected]