Merge pull request #1920 from shubhwebkul/master

Throw exception when user is not is session
This commit is contained in:
Jitendra Singh 2019-12-19 16:05:46 +05:30 committed by GitHub
commit 8ef4c64d01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 7 deletions

View File

@ -44,8 +44,7 @@ class ReviewController extends Controller
public function __construct(
ProductRepository $productRepository,
ProductReviewRepository $productReviewRepository
)
{
) {
$this->productRepository = $productRepository;
$this->productReviewRepository = $productReviewRepository;
@ -57,15 +56,17 @@ class ReviewController extends Controller
* Show the form for creating a new resource.
*
* @param string $slug
* @return \Illuminate\View\View
* @return \Illuminate\View\View
*/
public function create($slug)
{
$product = $this->productRepository->findBySlugOrFail($slug);
if (auth()->guard('customer')->check() || core()->getConfigData('catalog.products.review.guest_review')) {
$product = $this->productRepository->findBySlugOrFail($slug);
$guest_review = core()->getConfigData('catalog.products.review.guest_review');
return view($this->_config['view'], compact('product', 'guest_review'));
}
return view($this->_config['view'], compact('product', 'guest_review'));
abort(404);
}
/**
@ -103,7 +104,7 @@ class ReviewController extends Controller
* Display reviews of particular product.
*
* @param string $slug
* @return \Illuminate\View\View
* @return \Illuminate\View\View
*/
public function show($slug)
{