Вот что я пытаюсь:
Код: Выделить всё
foreach ($tree as $k => $d) {
if (!$d->home) {
$obj = [
'teamName' => "Winner of Match $d->tempHomeTeam",
'player1' => [
'firstName' => 'Player1',
'lastName' => '',
],
'player2' => [
'firstName' => 'Player2',
'lastName' => '',
],
];
$tree[$k]->home = $obj;
// or
$d->home = $obj;
}
}
Подробнее здесь: https://stackoverflow.com/questions/693 ... collection
Мобильная версия