php - How to name an array when using map function on a collection in Laravel -


i need build structure collection in laravel. each block should have subarray named $operators_participants , each of these should have 2 fields (operators , role_operator_id)..

this attempt:

$blocks = $dd->participants->map(function ($i, $k) {         $operators_participants = $i->operators->map(function ($item, $key) {             return [                 'operator' => $item,                 'role_operator_id' => $item->pivot->role_operator_id             ];         });         return $operators_participants;     }); 


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -