dd(FuwMapping::where('template','=','NB5215')->get()->map(function($item) use ($content) {
$value = array_get($content, $item->json_field);
return $value;
}));
Collection {#233
#items: array:7 [
0 => "Broker Dealer"
1 => "F. M. Dostoevsky"
2 => "999-99-9999"
3 => "(999) 999-9999"
4 => "test@test.com"
5 => null
6 => "01/01/1980"
]
}
dd(FuwMapping::where('template','=','NB5215')->get()->mapWithKeys(function($item) use ($content) {
return [$item->pdf_field => array_get($content, $item->json_field)];
}));
Collection {#412
#items: array:7 [
"Firm" => "Broker Dealer"
"ProducerName" => "F. M. Dostoevsky"
"SSN" => "999-99-9999"
"PhoneNumber" => "(999) 999-9999"
"Email" => "test@test.com"
"InsuredName" => null
"InsuredBirth" => "01/01/1980"
]
}