Jun 12, 2019
2
Level 1
Relationship m2m, Eloquent. HELP PLS
I have 3 tables: orders, products, order_product. There are 4 columns in order_product table: id, order_id, product_id, count. I already make a relationship between tables. How can i create new order and immediately attach him few products with count from form? I created new func in ordercontroller:
public function newOrder(){ $order = new Order([ /data of order/ ]);
$order->save();
...
} what should i do next ?
Please or to participate in this conversation.