SelectFilter for multiple values in Json in field NOT WORKING
Hello.
I have a field called TAGS where user can select multiple.
I casted in the model:
And field is type: longText and stores in JSON like this:
["registros","otros"]
when user selected those two values.
I am trying the SelectFilter like this:
And nothing thows an error, and I can select one or more of those options, but NO DATA IS RETRIEVED.
As it was a simple field, I did not create a pivot table or relation for this.
Any ideas of how I can customize my filter to work?? Something like CONTAINS or WhereIn ?
Thank you very much.
Solution:Jump to solution
After quite a lot time testing and looking for information and debugging the returned array, I have the solution working:
```php
SelectFilter::make('tags')
->multiple()...
2 Replies
Solution
After quite a lot time testing and looking for information and debugging the returned array, I have the solution working:
The solution is the query with the whereJsonContains(...)