可有解?
$data = $this->mediaItemFlagModel()->with([
'item' => function (Relation $query) {
$query->with('image')
->field('id,title,type,is_free,vip_free,market_price,sales_price,vip_price,image,browse,check,status,order')
->where('check', true)
->where('status', 1)
->order('order', 'desc')
->withLimit(1)
;
}
])
->field('id,name,description')
->where('status',1)
->order('order')
->select();返回的数据"flag": [
{
"id": 1,
"name": "asdasd",
"item": [
{
"id": 93,
"title": "下",
"type": 1,
"order": 61,
"pivot": {
"media_id": 93,
"flag_id": 1
}
}
]
},
{
"id": 14,
"name": "测试专区 请勿删除",
"description": "测试专区 请勿删除",
"item": []
}
]
} 最佳答案