1 year ago

Relationship m2m, Eloquent

Posted 1 year ago by vovkacrackhead

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*/


what should i do next ?

Please sign in or create an account to participate in this conversation.