/** * Update the specified resource in storage. * * @param Request|NewsFormRequest $request * @param NewsRepositoryInterface $repositoryInterface * @param int $id * @return Response */ public function update(NewsFormRequest $request, NewsRepositoryInterface $repositoryInterface, $id) { $name = $request->get('title'); $content = $request->get('content'); $slug = $request->get('slug'); $category = $request->get('category'); $addImages = testImages($request->get('imagesList')); $removeImages = testImages($request->get('removeList')); if ($repositoryInterface->update($id, $name, $slug, $category, $content, $addImages, $removeImages)) { \Message::success('Notícia Editada'); return redirect()->route($this->admin_route); } \Message::danger('Erro a editar a notícia'); return back(); }
/** * Update the specified resource in storage. * * @param Request|SpecFormRequest $request * @param SpecRepositoryInterface $repositoryInterface * @param int $id * @return Response */ public function update(SpecFormRequest $request, SpecRepositoryInterface $repositoryInterface, $id) { $category = $request->get('category'); $name = $request->get('name'); $descriptions = $request->get('description'); $addImageAux = testImages($request->get('imagesList')); $addImage = is_null($addImageAux) ? null : $addImageAux[0]; $removeImageAux = testImages($request->get('removeList')); $removeImage = is_null($removeImageAux) ? null : $removeImageAux[0]; if ($repositoryInterface->update($id, $category, $name, $descriptions, $addImage, $removeImage)) { \Message::success('Especificação Editada'); return redirect()->route($this->admin_route); } \Message::danger('Erro a editar a Especificação'); return back(); }