Download the PHP package kalimeromk/filterable without Composer
On this page you can find all versions of the php package kalimeromk/filterable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kalimeromk/filterable
More information about kalimeromk/filterable
Files in kalimeromk/filterable
Package filterable
Short Description Address commonly face the problem of adding repetitive filtering code
License MIT
Informations about the package filterable
Filterable
In Laravel, we commonly face the problem of adding repetitive filtering code, sorting and search as well this package will address this problem.
Install
composer require kalimeromk/filterable
Usage for Filtering property
To use Filterable trait we need to include trait into our model
While adding Filterable trait in the model class, we need to add some properties as well.
Examples
After all the above changes, now we only need to call filter() function with Request array data
Usage for Sort property
To use Sortable trait we need to include trait into our model
While adding Sortable trait in the model class, we need to add some properties as well.
Examples
After all the above changes, now we only need to call sort() function with Request array data
Example below allows sorting for the columns: id, name, email, address
Trait usage
Below is an example of the usage of the sortable trait (query scope).
Usage for whereLike property
To use whereLike search need first to specified all the table row you want to search try
Examples
After all the above changes, now we only need to call whereLike() function with Request array data
Example below allows searching for the columns: name, email, address
this method can be used to search try relation as well just update const with relation and row name for search
whereLike usage
Below is an example of the usage of the whereLike method (query scope).
NOTE: This also works with filter, sort and with pagination
Testing
Run the tests with:
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Credits
Security
If you discover any security-related issues, please email [email protected] or use the issue tracker.
License
The MIT License (MIT). Please see License File for more information.