I have return data like below json object,
{
"user_token":"ad48c412-3866-4ac9-adf6-3328911ae46c",
"order_info":
{"order_id":"CGC12345678","company_id":32,"price":1000.5,"currency":"MYR",
"products":[
{"type":"hr_claims","name":"HR Claims","is_fixed_price":true,"price":500.5,"currency":"MYR"},
{"type":"hr_leave","name":"HR Leave","is_fixed_price":true,"price":500,"currency":"MYR"},
{"type":"finance_advisory","name":"FinanceAdvisory","is_fixed_price":false,"currency":"MYR"}
],
"total_invoices":200,
"total_staffs":80
}
}
i want to save this one object in php table one row but since products have 3 different array i cannot get all 3 [products][name] in to one record in php table.
Like below products - HR Claims, HR Leave, Finance Advisory
Can someone help me?
This is i try! This one return last one!
<td>
@php
$json = $order->data;
$json = json_decode($json, true);
$products = $json['order_info']['products'];
foreach ($products as $hitsIndex => $hitsValue) {
$data = $hitsValue['name']. '<br/>';
}
@endphp
</td>
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire