小编Mat*_*rez的帖子

如何使用 Eloquent 在包含对象数组的 json 字段中进行搜索

我正在尝试使用 Eloquent 在 JSON 字段中进行搜索,但现在可以工作,搜索结果为 0。

这是针对 Ubuntu 服务器,运行 PostgresSQL、Laravel 5.8 和 Apache 2。

[{
    "value": "1",
    "label": "numero"
},{
    "value": "2016",
    "label": "anio"
},{
    "value": "Acer",
    "label": "especie"
},{
    "value": "2",
    "label": "cant_plantar"
}]
Run Code Online (Sandbox Code Playgroud)
PlanificacionInfo::select('datos_complementarios')->WhereJsonContains('datos_complementarios', ["value" => "Escamonda 2019"]);
Run Code Online (Sandbox Code Playgroud)

查询返回空

postgresql json laravel eloquent

1
推荐指数
1
解决办法
5224
查看次数

标签 统计

eloquent ×1

json ×1

laravel ×1

postgresql ×1