This is my result tree which I want to filter by 'language_code' field
"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": []
}
]
}
]
}
]
This is my json array which is in a tree like structure. This array is the result of a recursive eloquent relation. Now I want to filter it by a specific language code or by any other field. How can I do it using Laravel eloquent? can anybody help?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire