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