From a6801ef182fa5348bb35ceff177e1ef3eb48e7fb Mon Sep 17 00:00:00 2001 From: TL Date: Fri, 12 Aug 2022 17:02:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- beike/Models/Product.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/beike/Models/Product.php b/beike/Models/Product.php index 3f490053..663a7420 100644 --- a/beike/Models/Product.php +++ b/beike/Models/Product.php @@ -52,6 +52,11 @@ class Product extends Base return $this->belongsTo(Brand::Class, 'brand_id', 'id'); } + public function inCurrentWishlist() + { + return $this->hasOne(CustomerWishlist::class)->where('customer_id', current_customer() ? current_customer()->id : 0); + } + public function getPriceFormattedAttribute(): string { return '$' . $this->price;