mehdi-fathi / eloquent-filter

Eloquent Filter is a package for filter data of models by the query strings. Easy to use and fully dynamic.
https://mehdi-fathi.github.io/eloquent-filter/
MIT License
430 stars 43 forks source link

Filter not working when using WHERE LIKE with nested relationships and request_filter_key set in config #183

Closed samik-os closed 2 years ago

samik-os commented 2 years ago

Filter not working when using WHERE LIKE with nested relationships and request_filter_key set in config I have request_filter_keyset in config to 'filter'. So my query parameter for a WHERE LIKE becomes filter[relation.column][like]. Eloquent Filter tries to parse this relation.column as a column name instead of querying a nested relation.

To Reproduce Steps to reproduce the behavior:

  1. Set request_filter_key to a string in Eloquent Filter config.
  2. Send query param in a key[relation.column][like] format.
  3. Exception occurs: Column not found: 1054 Unknown column 'relation.column' in 'where clause'

Expected behavior Query should filter with WHERE LIKE regardless of nesting.

Screenshots If applicable, add screenshots to help explain your problem.

Environment:

mehdi-fathi commented 2 years ago

@samik-os you should read https://github.com/mehdi-fathi/eloquent-filter#Custom-Detection-Condition for more details. Believe I couldn't make all of the features that you need just I can make a clean structure for implementing your need. you can use of custom-detection-Condition or custom query in this case. read more readme file.