error message in case user redirecting to review page of deleted product

This commit is contained in:
sanjeev 2022-07-07 17:29:17 +05:30
parent 11eadd3c9c
commit d72beab56e
1 changed files with 6 additions and 1 deletions

View File

@ -34,7 +34,12 @@ class ReviewController extends Controller
public function create($slug)
{
if (auth()->guard('customer')->check() || core()->getConfigData('catalog.products.review.guest_review')) {
$product = $this->productRepository->findBySlugOrFail($slug);
$product = $this->productRepository->findBySlug($slug);
if ($product == null) {
session()->flash('error', trans('customer::app.product-removed'));
return redirect()->back();
}
return view($this->_config['view'], compact('product'));
}