diff --git a/Changelog.md b/Changelog.md index 9936d6bb..ec1c1244 100644 --- a/Changelog.md +++ b/Changelog.md @@ -14,7 +14,7 @@ - Added the `currency` field to the orders table - Added `currency` field to the Channel model/table - Added the `is_hidden` field to the `Property` model -- Added the `withImages` method to the product search class (eager loads media) +- Added the `withImages` and `withChannels` methods to the product search class (eager loads media) - Added the `channelables` table for being many-to-many polymorphic relationships with channels and arbitrary models - Added the `mapInto()` method to the `RelationAdjustmentCollection` class, which forwards the call to the underlying Eloquent collection - Added the `Channelable` behavior to Foundation Product, MasterProduct, PaymentMethod, ShippingMethod and Taxonomy classes diff --git a/src/Foundation/Search/ProductSearch.php b/src/Foundation/Search/ProductSearch.php index 315216b4..ce29e6c3 100644 --- a/src/Foundation/Search/ProductSearch.php +++ b/src/Foundation/Search/ProductSearch.php @@ -256,6 +256,14 @@ public function withImages(): self return $this; } + public function withChannels(): self + { + $this->productQuery->with('channels'); + $this->masterProductQuery->with('channels'); + + return $this; + } + public function getSearcher(): Searcher { return $this->searcher