Table Filter for Repeater Json Column
Hi guys.
I am having problems with the data saved by a repeater.
As the documentation says, I created a json column for the repeater and casted it to array in the model. Now I'm trying to create a filter on that column, but the
where
and whereJsonContains
Eloquent methods don't seem to work.
I've also tried with raw SQL but it doesn't find any record.
Here's the content of the column:
Am I doing something wrong? Thank you very much for your help and sorry for the stupid question.
In the images: my repeater code and the filter.Solution:Jump to solution
The error was caused by my test data: by using
json_encode
in the factory code, together with casting, the json was saved with the ""
.
Maybe it can be useful in the future for someone with a problem similar to mine π₯²...3 Replies
I've understood that the problem is that the JSON is saved as a string. In fact, I've delete the "" manually in the db and the query works.
But how to do it in the code? π
The query in the image works, but only for the record where I deleted the
""
around the JSONSolution
The error was caused by my test data: by using
json_encode
in the factory code, together with casting, the json was saved with the ""
.
Maybe it can be useful in the future for someone with a problem similar to mine π₯²