* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) */ class ReviewController extends Controller { /** * Contains route related configuration * * @var array */ protected $_config; /** * ProductRepository object * * @var array */ protected $product; /** * ProductReviewRepository object * * @var array */ protected $productReview; /** * Create a new controller instance. * * @param Webkul\Product\Repositories\ProductRepository $product * @param Webkul\Product\Repositories\ProductReviewRepository $productReview * @return void */ public function __construct(Product $product, ProductReview $productReview) { $this->product = $product; $this->productReview = $productReview; $this->_config = request('_config'); } /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { return view($this->_config['view']); } /** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $review = $this->productReview->find($id); return view($this->_config['view'],compact('review')); } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { $this->productReview->update(request()->all(), $id); session()->flash('success', 'Review updated successfully.'); return redirect()->route($this->_config['redirect']); } }