I am using Laravel 5.3.
existing Collection $a is
$a = collect(
[
[
'firstName' => 'John',
'lastName' => 'Doe'
],
['firstName' => 'Mary',
'lastName' => 'Jane'
]
]);
and desired result is as below:
$a = collect(
[
[
'firstName' => 'John',
'lastName' => 'Doe',
'occupation' => 'engineer'
],
['firstName' => 'Mary',
'lastName' => 'Jane',
'occupation' => 'accountant'
]
]);
I tried to test ->push(), ->put(), ->prepend() but no success. Please let me know the best way to do this.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire