這是我的結果樹,我想通過「LANGUAGE_CODE」過濾領域一個特定的字段進行篩選像陣列樹如何使用Laravel雄辯
"theme_detail": [
{
"id": 1,
"parent_theme_id": null,
"image_url": "no_image",
"index_value": 1,
"status": "active",
"theme_detail": [
{
"id": 4,
"theme_id": 1,
"language_code": "bn",
"theme_name": "থিম 1",
"theme_subtitle": "থিম 1 উপশিরোনাম",
"status": "active"
},
{
"id": 1,
"theme_id": 1,
"language_code": "en",
"theme_name": "Theme 1",
"theme_subtitle": "Theme 1 Subtitle",
"status": "active"
}
],
"parent_recursive": [
{
"id": 2,
"parent_theme_id": 1,
"image_url": "no_image",
"index_value": 1,
"status": "active",
"theme_detail": [
{
"id": 5,
"theme_id": 2,
"language_code": "bn",
"theme_name": "থিম 2",
"theme_subtitle": "থিম 2 উপশিরোনাম",
"status": "active"
},
{
"id": 2,
"theme_id": 2,
"language_code": "en",
"theme_name": "Theme 2",
"theme_subtitle": "Theme 2 Subtitle",
"status": "active"
}
],
"parent_recursive": [
{
"id": 3,
"parent_theme_id": 2,
"image_url": "no_image",
"index_value": 1,
"status": "active",
"theme_detail": [
{
"id": 3,
"theme_id": 3,
"language_code": "en",
"theme_name": "Theme 3",
"theme_subtitle": "Theme 3 Subtitle",
"status": "active"
},
{
"id": 6,
"theme_id": 3,
"language_code": "bn",
"theme_name": "থিম 3",
"theme_subtitle": "থিম 3 উপশিরোনাম",
"status": "active"
}
],
"parent_recursive": [
{
"id": 4,
"parent_theme_id": 3,
"image_url": "no_image",
"index_value": 1,
"status": "active",
"theme_detail": [
{
"id": 7,
"theme_id": 4,
"language_code": "bn",
"theme_name": "থিম 4",
"theme_subtitle": "থিম 4 উপশিরোনাম",
"status": "active"
},
{
"id": 9,
"theme_id": 4,
"language_code": "en",
"theme_name": "Theme 4",
"theme_subtitle": "Theme 4 Subtitle",
"status": "active"
}
],
"parent_recursive": []
}
]
},
{
"id": 5,
"parent_theme_id": 2,
"image_url": "no_image",
"index_value": 1,
"status": "active",
"theme_detail": [
{
"id": 8,
"theme_id": 5,
"language_code": "bn",
"theme_name": "থিম 5",
"theme_subtitle": "থিম 5 উপশিরোনাম",
"status": "active"
},
{
"id": 10,
"theme_id": 5,
"language_code": "en",
"theme_name": "Theme 5",
"theme_subtitle": "Theme 5 Subtitle",
"status": "active"
}
],
"parent_recursive": []
}
]
}
]
}
]
這是我的JSON數組這是在像結構樹。 這個數組是遞歸雄辯關係的結果。 現在我想通過特定的語言代碼或任何其他字段來過濾它。 我怎樣才能用Laravel雄辯呢? 任何人都可以幫忙嗎?
可以顯示雄辯奧姆查詢? –
https://stackoverflow.com/questions/46708457/how-to-pass-parameter-from-controller-to-model-in-case-of-recursion。這是我已經發布我的模型和控制器的鏈接。請檢查一下。如果它能夠在雄辯的ORM級別上解決,那麼它對我更有幫助。 –
你會得到'language_code'數組嗎?或者你會創建單個代碼? –