/** * Update the specified ProductCost in storage. * PUT/PATCH /productCosts/{id} * * @param int $id * @param Request $request * * @return Response */ public function update($id, Request $request) { $input = $request->all(); /** @var ProductCost $productCost */ $productCost = $this->productCostRepository->apiFindOrFail($id); $result = $this->productCostRepository->updateRich($input, $id); $productCost = $productCost->fresh(); return $this->sendResponse($productCost->toArray(), "ProductCost updated successfully"); }
/** * Update the specified ProductCost in storage. * * @param int $id * @param UpdateProductCostRequest $request * * @return Response */ public function update($id, UpdateProductCostRequest $request) { $productCost = $this->productCostRepository->find($id); if (empty($productCost)) { Flash::error('ProductCost not found'); return redirect(route('productCosts.index')); } $this->productCostRepository->updateRich($request->all(), $id); Flash::success('ProductCost updated successfully.'); return redirect(route('productCosts.index')); }