I am trying to search data in column that has array data type.
[
{
"_id": 1,
"types: [
["4","5","6"], ["7","8","9"]
]
},
{
"_id": 2,
"types: [
["4","1","2"], ["7","8","9"]
]
},
{
"_id": 3,
"types: [
["6","1","2"], ["7","8","9"]
]
},
]
I want to query data that column named types
contains value "4". So it will return
[
{
"_id": 1,
"types: [
["4","5","6"], ["7","8","9"]
]
},
{
"_id": 2,
"types: [
["4","1","2"], ["7","8","9"]
]
},
]
This is what I've tried but it does not work.
Employee::where('types', '=', $num)->get();