我创建了customer_products表来存储different_price数据。现在,我尝试返回different_price以显示数据。如何从customer_products表中获取数据?
//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');
}