From 99eae1f9f3c4ab063e0090a137f1c1bd840c858f Mon Sep 17 00:00:00 2001 From: liapples Date: Mon, 26 Jul 2021 18:47:34 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=A2=9E=E5=8A=A0coupon=E5=85=B3?= =?UTF-8?q?=E8=81=94=EF=BC=9B2=E3=80=81product=E5=85=B3=E8=81=94=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0where('status',=201)=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/AgentProduct.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Models/AgentProduct.php b/app/Models/AgentProduct.php index a4bb481..163923c 100644 --- a/app/Models/AgentProduct.php +++ b/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]); } }