/** * Update the faq. * * @param Request $request * @param Model $faq * * @return json */ public function update(FaqAdminApiRequest $request, Faq $faq) { try { $attributes = $request->all(); $faq->update($attributes); $faq = $faq->presenter(); $faq['code'] = 2005; return response()->json($faq)->setStatusCode(201, 'UPDATE_SUCCESS'); } catch (Exception $e) { return response()->json(['message' => $e->getMessage(), 'code' => 4005])->setStatusCode(400, 'UPDATE_ERROR'); } }
/** * Update the faq. * * @param Request $request * @param Model $faq * * @return Response */ public function update(FaqAdminRequest $request, Faq $faq) { try { $attributes = $request->all(); $faq->update($attributes); return response()->json(['message' => trans('messages.success.updated', ['Module' => trans('faq::faq.name')]), 'code' => 204, 'redirect' => trans_url('/admin/faq/faq/' . $faq->getRouteKey())], 201); } catch (Exception $e) { return response()->json(['message' => $e->getMessage(), 'code' => 400, 'redirect' => trans_url('/admin/faq/faq/' . $faq->getRouteKey())], 400); } }