Im trying to insert this multidemensional array from a nested json but im not sure how to tackle this. The array shows as the following when printed:
{
"CompanyCode": "12345",
"CustomerNumber": "ABC0012300DEF",
"RequestID": "2017262221400000001975",
"ChannelType": "2014",
"CustomerName": "Customer Virtual Account",
"CurrencyCode": "IDR",
"PaidAmount": "60000.00",
"TotalAmount": "100000.00",
"SubCompany": "",
"TransactionDate": "15/03/2014 22:07:40",
"Reference": "",
"DetailBills": [
{
"BillAmount": "25000.00",
"BillNumber": "1234567890",
"BillSubCompany": "00002",
"BillReference": "12345678900"
},
{
"BillAmount": "35000.00",
"BillNumber": "2234567891",
"BillSubCompany": "00003",
"BillReference": "22345678901"
}
],
"FlagAdvice": "N",
"Additionaldata": ""
}
here's my code in laravel with db::insert :
DB::insert('insert into bca_company_payload (companyCode, customerNumber, requestID, channelType, customerName, paidAmount, totalAmount, subCompany, transactionDate, reference, flagAdvice, addtionalData) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', [$company_code, $customer_number, $request_id, $channel_type, $customer_name, $currency_code, $paid_amount, $total_amount, $sub_company, $transaction_date, $reference, $detail_bills, $flag_advice, $addtional_data]);
return response()
->json('The data was successfully inserted', 200)
->header('Access-Control-Allow-Origin', '*');