Merhaba arkadaşlar, Laravel ile stok takip programı yazıyorum, Fatura kısmına ürünleri ekliyorum ve submit ediyorum
<thead>
<tr>
<th style="width:5%" colspan="2">No</th>
<th style="width:65%">Product Name</th>
<th style="width:10%">Quantity</th>
<th style="width:10%">Unit Price</th>
<th style="width:10%">Total</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="invoice in invoices">
<td><span ng-click="remove($index)" class="btn btn-danger btn-xs"><span class="icon-trash2"></span></span></td>
<td><%index%><input type="hidden" name="company_id" value="555"></td>
<td><%invoice.name%><input type="hidden" name="product_id[]" value="<%invoice.id%>"></td>
<td><input type="number" ng-model="invoice.qty" name="qty[]" style="padding: 10px; margin: 0px; width: 70px; height: 20px;" /></td>
<td><input type="number" ng-model="invoice.price" name="price[]" style="padding: 10px; margin: 0px; width: 70px; height: 20px;" /></td>
<td><%invoice.qty * invoice.price%> SR</td>
</tr>
<tbody>
Formu Submit ettiğimde return $request->all(); dönen verileri aşağıdaki şekilde alıyorum
{
_token: "HpKg3rFRec3mQtc3tVx6ViaSuqoBUcNlWxDbmqI9",
company_id: "555",
product_id: [
"1",
"2"
],
qty: [
"100",
"300"
],
price: [
"2",
"3"
]
}
ben bu çıktıyı $ekle=Invoice::created($request->all()); dediğim zaman hata alıyorum
Hata codu:
lluminate \ Database \ QueryException
Array to string conversion (SQL: insert into `invoices` (`company_id`, `product_id`, `qty`, `price`, `updated_at`, `created_at`) values (555, 1, 100, 2, 2018-08-07 12:47:02, 2018-08-07 12:47:02))
bu veriyi veritabanına kayıt edeceğim şekle dönüştürmek istiyorum bunu nasıl yapabilirim yardımcı olurmusunuz yani çıktıyı php ile kendi istediğim hale dönüştürmek istiyorum ,