Mapeo de JSONs
This commit is contained in:
@ -21,6 +21,12 @@ class Facturas extends Controller
|
||||
'success' => false
|
||||
];
|
||||
try {
|
||||
foreach (['cliente', 'unidades', 'detalle', 'total', 'uf'] as $key) {
|
||||
if (!isset($data[$key]) or empty($data[$key])) {
|
||||
continue;
|
||||
}
|
||||
$data[$key] = json_decode($data[$key], true);
|
||||
}
|
||||
$output['factura'] = $facturaService->add($data);
|
||||
$output['success'] = true;
|
||||
} catch (Implement\Exception\EmptyResult) {
|
||||
|
Reference in New Issue
Block a user