Пример #1
0
 /**
  * @param Product $product
  *
  * @throws \BadMethodCallException
  *
  * @return Collection
  */
 public function similarProducts(Product $product) : Collection
 {
     $key = $this->key("product.{$product->id}.similar");
     if ($this->cacheHas($key)) {
         return $this->cacheGet($key);
     }
     $similar = $this->catalogueRepository->loadSimilarProducts($product);
     $this->cachePut($key, $similar, Carbon::now()->addDays(7));
     return $similar;
 }