$rosters = EventRosters::where('event_id', $event_id)
->whereJsonContains('players', $user_id)
->whereNull('deleted_at')
->get();
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.
See Question&Answers more detail:os