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