Merhaba,
Şu şekilde bir sql datam mevcut:
{
"17": [
{
"attributeValueID": "109026",
"attributeValue": "Yok"
}
],
"18": [
{
"attributeValueID": "109030",
"attributeValue": "3G"
}
],
"19": [
{
"attributeValueID": "109036",
"attributeValue": "Var"
}
],
"20": [
{
"attributeValueID": "109039",
"attributeValue": "20"
}
]
}
Bu şekilde bir arama yaptığımda bana 17 keyine sahip değerin attributeValueID'sini veriyor:
select JSON_EXTRACT(pAttributeList,"$.17[*].attributeValueID") from
integration_product_matches`
Sonuç : ["109026"]
Dışarıdan aldığım istekte sadece 17 ve 19 keyine sahip değerlerin aynı olmaması için bir kontrol sağlamaya çalışıyorum.
Şu şekilde bir şey denemeye çalıştım ama olmadı.
$databaseControl = IntegrationProductMatches::where(
"pGroupCode", null)
->where("categoryID", 13)
->where(function($query){
$query->whereRaw("JSON_EXTRACT(pAttributeList,'$.17[*][\"attributeValueID\"]') IN ('109026')");
})
->get();