#whereJsonContains usage
1 messages · Page 1 of 1 (latest)
With whereJsonContains('user_data->y', '5555') 😉
The syntax you give is not working. It output an empty array
It's from doc - https://laravel.com/docs/11.x/queries#json-where-clauses
and simple where('user_data->y', '5555') ?
I assume that this column has type json, right?
Yes I try it before posting the question
Note that in the json you get x as a key in one object and y as a key on the other object
Your syntax work in the case where you have something like this [{‘x’:’3333´}, {‘x’:’4444’}]
Ok, i tested it and it seems that for json array content it should be like this whereJsonContains('user_data', ['y' => '5555'])