Browse Source

1、增加coupon关联;2、product关联增加where('status', 1)条件

dev
李可松 4 years ago
parent
commit
99eae1f9f3
  1. 7
      app/Models/AgentProduct.php

7
app/Models/AgentProduct.php

@ -10,6 +10,11 @@ class AgentProduct extends BaseModel
public function product()
{
return $this->belongsTo(Product::class);
return $this->belongsTo(Product::class)->where('status', 1);
}
public function coupon()
{
return $this->hasMany(Coupon::class)->orWhereIn('agent_product_id', [0]);
}
}
Loading…
Cancel
Save