public function __construct(ProductDetail $productdetail, Product $product, Brand $brand) { $this->product = $product->where('company_id', Auth::user()->company_id)->where('account_year_id', session('account')); $this->brand = $brand->where('company_id', Auth::user()->company_id)->where('account_year_id', session('account')); $this->productdetail = $productdetail->where('company_id', Auth::user()->company_id)->where('account_year_id', session('account')); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id, Request $request) { $v = Validator::make($request->all(), $this->form_rules, trans('features.validation_messages')); if ($v->fails()) { return redirect()->back()->withErrors($v->errors())->withInput(\Input::except('default', 'message')); } $data = $this->accommodateDataStorage($request->all()); if (array_key_exists('error', $data)) { return redirect()->back()->withErrors($data)->withInput(\Input::except('default', 'message')); } ProductDetail::where('id', $id)->update($data); \Session::flash('message', trans('features.update_message')); return redirect('wpanel/features'); }