/** * @param int $productId * @param string $slug * * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException * * @return \Illuminate\Contracts\View\View|\Illuminate\Http\Response */ public function viewAction(int $productId, string $slug) { $product = $this->productRepository->loadAlone($productId); if (!$product->id) { throw new NotFoundHttpException(); } if ($product->slug !== $slug) { return $this->responseFactory->redirectToRoute('product::view', ['id' => $product->id, 'slug' => $product->slug], 301); } return $this->view->make('customer.product.view', ['product' => $this->view->getProduct($product), 'meta' => $this->view->productMeta($product), 'similar' => $this->view->similarProducts($product)]); }
/** * @throws \BadMethodCallException * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function getIndex() { return $this->view->make('welcome', ['productRows' => $this->view->frontProducts()->chunk(4)]); }