I have small Laravel project working on collection editing. I have eloquent as below.
public function Import(){
$org = LabGroup::get();
return $org;
}
The returned result as below,
[
{
id: 1,
uuid: "491cd440-79d0-11e9-a294-b93a2fd40038",
branch: 0,
name: "productA",
},
{
id: 2,
uuid: "491d0b70-79d0-11e9-aba8-4d9cdb66858f",
branch: 0,
name: "productB",
},
{
id: 3,
uuid: "491d0c20-79d0-11e9-a243-0d208e55c95a",
branch: 0,
name: "productC",
}
]
My need is to change all branch value from 0 to 1. I can do by loop through but I may use other better like 'map'
that I'm not familiar. Any advise or guidance would be greatly appreciated, Thanks.