I have something like this:
Collection {#296 ▼
#items: array:1318 [▼
0 => {#289 ▼
+"Column1": "string1"
+"Column2": "string2"
+"Column3": "string3"
+"Column4": "string4"
+"Column5": "string5"
}
1 => {#292 ▼
+"Column1": "string6"
+"Column2": "string7"
+"Column3": "string8"
+"Column4": "string9"
+"Column5": "string10"
}
2 => {#293 ▼
+"Column1": "string11"
+"Column2": "string12"
+"Column3": "string13"
+"Column4": "string14"
+"Column5": "string15"
}
]
}
For each "Column1" I need to change the string value to another. Can you help me? Regards
I'll explain better now:
if Column1 is equal to a certain value, then Column2 is equal to my string
I have tried this:
foreach($all as $key=>$row){
if($row->Column1 = 'NUMAX'){
$ipoltstatus = Str::before($row->message, '_');
$olthostname = Olt::where('ipaddress', $ipoltstatus)->value('hostname');
$row->Column2 = $olthostname;
}
what happens is that all Column1 columns mistakenly take the NUMAX value and column2 becomes empty