I have two collections in Laravel 5.2. I want merge this two collection if the key design_name and name are equal.
$family_article_design = collect($list_config['designs']);
Collection {#311 ▼
#items: array:1 [▼
0 => array:2 [▼
"design_name" => "blue edition"
"tags" => array:5 [▼
0 => "pokemon"
1 => "pixelart"
2 => "pokemon blue"
3 => "pokémon"
4 => "pokemon azul"
]
]
]
}
$list_designs = collect($list_designs);
Collection {#315 ▼
#items: array:1 [▼
0 => Design {#314 ▼
#design_id: "72fws359rjgw"
#name: "blue edition"
#user_id: 0
#article_id: 1728
#application_id: 1028
#popularity: 0
#date_creation: "2016/05/17T22:59:49Z"
#total_tags: 0
#total_design_lines: 1
#active: true
#tags: []
#permissions: []
#design_lines: []
#design_pages: []
}
]
}
Something like:
if($family_article_design->design_name == $list_designs->name)
merge($family_article_design item and $list_designs item)
I want this result:
Collection {#315 ▼
#items: array:1 [▼
0 => Design {#314 ▼
#design_id: "72fws359rjgw"
#tags => array:5 [▼
0 => "pokemon"
1 => "pixelart"
2 => "pokemon blue"
3 => "pokémon"
4 => "pokemon azul"
]
#name: "blue edition"
#user_id: 0
#article_id: 1728
#application_id: 1028
#popularity: 0
#date_creation: "2016/05/17T22:59:49Z"
#total_tags: 0
#total_design_lines: 1
#active: true
#tags: []
#permissions: []
#design_lines: []
#design_pages: []
}
]
}
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/253roxC
via IFTTT
Aucun commentaire:
Enregistrer un commentaire