Open AhnabShahin opened 6 months ago
Thank you to the author and contributors for creating this useful package! Purity has significantly enhanced my workflow, and I deeply appreciate the effort and dedication that has gone into its development.
However, I have encountered an issue where I can't filter numeric values and Boolean values. Here is the solution in a pull request that will convert the value into a numeric if it is numeric, or a Boolean if it is Boolean
Hi @AhnabShahin .
It's good to hear that Purity helped you in your projects. Also, Thank you for your contribution to Purity.
In Purity, values get converted to a string and won't cause any errors because Purity in its core uses Laravels query builder, for example, the $eq
uses the where()
function from eloquent. This function accepts string values and converts them into corresponding values. in the case of boolean values, you must filter them by 0 and 1.
Furthermore, in #70 I added more tests for different value types to confirm the correctness of Laravel Purity. Check out this tests
@AhnabShahin keep in mind all of our tests are running in SQLite and MySQL databases and Eloquent if you have any errors it is related to MongoDB and Moloquent. Do have mismatched results?
@abbasudo It's not an error! I'm just getting mismatched results when using MongoDB with the help of the "laravel-mongodb" package, which is the official MongoDB package for Laravel. If this "Purity" package doesn't support MongoDB, I'm willing to fork it to make it workable and suitable for myself.
@AhnabShahin that's great. Please inform me of any updates on your fork.
Filter example :
?filters[gpa][$eq]=3.11
?filters[gpa][$eq]=4
?filters[gpa][$eq]=False
?filters[is_default][$eq]=true
Database Using : MongoDB using https://github.com/mongodb/laravel-mongodb
Problem Details:
The URL parameters are being converted into strings, but the corresponding values in my database are integers or floats. As a result, there's a mismatch and I'm not getting any matching results.