/**
  * Display the specified resource.
  *
  * @param $id
  * @return Response
  */
 public function show($id)
 {
     $product = $this->productRepository->publishedOrSelledById($id);
     $comments = $product->comments()->where('comment_id', '=', 0)->paginate(5);
     $photos = $this->photoRepository->getPhotos($product->id);
     if (Auth()->user()) {
         $commentsNotViewed = $product->comments()->notViewed()->where('user_id', '=', Auth()->user()->id)->get();
         foreach ($commentsNotViewed as $comment) {
             $comment->viewed = true;
             $comment->save();
         }
     }
     return view('products.show')->with(compact('product', 'photos', 'comments'));
 }