This is my code
$dataSet = [];
foreach ($answers as $index => $answer) {
$dataSet[] = [$answer->formfield => $answer->answer];
}
dd($dataSet);
Here is how it looks:
array:14 [▼
0 => array:1 [▼
"BC_NC_USCIS_NAME1" => "KIMBERLY JAX SMITH"
]
1 => array:1 [▼
"Birth_name_styled_in_upper_case_lower_case" => "Kimberly Jax Smith"
]
2 => array:1 [▼
"Name_of_the_Trust_2" => "KJSmith, LLC."
]
3 => array:1 [▼
"FIRST_NAME_MIDDLE_INITIAL_LAST_NAME3" => "KIMBERLY J SMITH"
]
4 => array:1 [▶]
5 => array:1 [▶]
6 => array:1 [▶]
7 => array:1 [▶]
8 => array:1 [▶]
9 => array:1 [▶]
10 => array:1 [▶]
11 => array:1 [▶]
12 => array:1 [▶]
13 => array:1 [▶]
]
Here is what I need it to look like
array:8 [▼
"BC_NC_USCIS_NAME1" => "David"
"FIRST_NAME_MIDDLE_INITIAL_LAST_NAME1" => "Patrick"
"LAST_NAME_FIRST_NAME_MIDDLE_NAME_1" => "Smith"
"Current_Address" => "2042 E Quince St"
"Birth_name_styled_in_upper_case_lower_case" => "DAVID PATRICK SMITH"
"Current_City" => "Mesa"
"Current_State" => "AZ"
"Current_Zip_Code" => "85213"
]
Please help if you can! I am banging my head against the wall trying to figure it out.