From 724ef42e976c6836a7ab93206aab2e2b40981d6c Mon Sep 17 00:00:00 2001 From: merdan Date: Tue, 15 Aug 2023 14:53:23 +0500 Subject: [PATCH] search refactor3 --- .../Webkul/Product/src/Models/ProductFlat.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/Webkul/Product/src/Models/ProductFlat.php b/packages/Webkul/Product/src/Models/ProductFlat.php index ec4b01b86..c962e75ff 100644 --- a/packages/Webkul/Product/src/Models/ProductFlat.php +++ b/packages/Webkul/Product/src/Models/ProductFlat.php @@ -49,10 +49,26 @@ class ProductFlat extends Model implements ProductFlatContract { return 'products_index'; } + public function searchable(): bool { return $this->status || $this->visible_individually; } + + public function toSearchableArray():array + { + return [ + 'id' => $this->id, + 'name' => $this->name, + 'locale' => $this->locale, + 'channel' => $this->channel, + 'min_price' => $this->min_price, + 'meta_keywords' => $this->meta_keywords, + 'status' => $this->status, + 'visible_individually'=> $this->visible_individually, + 'product_id' => $this->product_id + ]; + } /** * Get an attribute from the model. *