Suppose I have a Model with db record like this:
row1: id: 1 users:["1","2","3"]
row2: id: 2 users:["3","4","5"]
Users are data formatted from json_encode(array($user_id)). Now I want to retrieve the model if user_id in users. So if my user_id is 2, i will retrieve only row 1, but if my user_id is 3, i will retrieve both row1 and row2.
I tried something like Model::whereIn('users', $user_id)->get();, it does not work, any other ways to achieve this Eloquent way?