Skip to content
Advertisement

whereJsonContains Laravel 5.6 not working?

JavaScript

The eloquent query above seems to only work when there is a single item in the ‘players’ json array.

The data stored in the database looks as follows: [1] vs ["1","2"]

Is there a reason the whereJsonContains is only working when it sees [1] in the db but not when it sees ["1","2"] ?

I am pretty new to Laravel and have been struggling with this one a bit.

Advertisement

Answer

The data types have to match:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement