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