1

I created the customer_products table to store the different_price data. Now I trying to return the different_price to show the data. How do I get the data from the customer_products table?

//Product table
    public function customers()
    {
        return $this->belongsToMany('Customer', 'customer_products')->withPivot('different_price');
    }

    //Customer table
    public function products()
    {
        return $this->belongsToMany('Product', 'customer_products')->withPivot('different_price');
    }
Ankur Tiwari
  • 2,762
  • 2
  • 23
  • 40
scarlet pro
  • 181
  • 12

0 Answers0