diff --git a/src/ContextTypes/Product.php b/src/ContextTypes/Product.php index f077ea6..a9a4c33 100644 --- a/src/ContextTypes/Product.php +++ b/src/ContextTypes/Product.php @@ -58,4 +58,25 @@ protected function setIsSimilarToAttribute($values) return $values; } + + + + /** + * Set the reviews + * + * @param array $items + * + * @return array + */ + protected function setReviewAttribute($items) + { + if (is_array($items) === false) { + return $items; + } + + return array_map(function ($item) { + return $this->getNestedContext(Review::class, $item); + }, $items); + } + }