【发布时间】:2021-03-24 11:41:42
【问题描述】:
我正在尝试这个查询:
$order = Order::whereJsonContains('products->id',$serial_no)->first();
但它不起作用,请帮我解决这个问题。提前致谢。
[
{
"id": 24,
"name": "test product",
"qnt": 3,
"sale_price": 18,
"buy_price": 14,
"stock": 3,
"total": 54,
"company": {
"id": 1,
"name": "test company",
"contact": "01521482467,5555555",
"address": "fdsa fdsa fdsa fdsa fdsa",
"is_active": 1
},
"brand": {
"id": 1,
"name": "Test Brand",
"is_active": 1
},
"category": {
"id": 1,
"name": "Test",
"is_active": 1
}
},
{
"id": 28,
"name": "test2",
"qnt": 1,
"sale_price": 18,
"buy_price": 12,
"stock": 1,
"total": 18,
"company": {
"id": 1,
"name": "test company",
"contact": "01521482467,5555555",
"address": "fdsa fdsa fdsa fdsa fdsa",
"is_active": 1
},
"brand": {
"id": 1,
"name": "Test Brand",
"is_active": 1
},
"category": {
"id": 2,
"name": "Test2",
"is_active": 1
}
}
]
【问题讨论】:
标签: laravel eloquent laravel-8