示例#1
0
 /**
  * 更新投稿
  *
  * @param ArticleRequest $request
  * @param PublishingArticleRepository $publishingArticleRepository
  * @param $id
  * @return \Illuminate\Http\RedirectResponse
  */
 public function update(ArticleRequest $request, PublishingArticleRepository $publishingArticleRepository, $id)
 {
     $article = $this->articleRepository->findOrFail($id);
     if ($request->is_check == '1') {
         $status = $publishingArticleRepository->create($request->all());
         if ($status) {
             $this->articleRepository->destroy($id);
         }
     } else {
         $this->articleRepository->update($request->all(), $article->id);
     }
     return redirect(route($this->indexRoute))->with('message', trans('validation.notice.update_article_success'));
 }
示例#2
0
 /**
  * 更新文章
  *
  * @param ArticleRequest $request
  * @param int $id
  * @return \Illuminate\Http\RedirectResponse
  */
 public function update(ArticleRequest $request, $id)
 {
     $article = $this->articleRepository->findOrFail($id);
     $status = $this->articleRepository->update($request->all(), $article->id);
     if (!$status) {
         return back()->with('fail', trans('validation.notice.database_error'));
     }
     $this->syncTags($article, $request->get('tags'));
     return redirect(route($this->indexRoute))->with('message', trans('validation.notice.update_article_success'));
 }