错误:数组到字符串的转换(SQL:插入到
order_product
(jml
,order_id
,product_id
中)的值是(4,23,11),(4, 23,11))
控制器
public function store(Request $request)
{
$newOrder = new \App\Order;
$newOrder->name = $request->get('name');
$newOrder->created_by = \Auth::user()->id;
$newOrder->save();
$jml = $request->get('jml');
$products = $request->get('product');
$newOrder->products()->attach($products, ['jml'=>$jml]);
$dt = $newOrder;
return view('order.details', ['data'=>$dt]);
}