当前位置: 首页>>代码示例>>PHP>>正文


PHP Article::update方法代码示例

本文整理汇总了PHP中app\Article::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Article::update方法的具体用法?PHP Article::update怎么用?PHP Article::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Article的用法示例。


在下文中一共展示了Article::update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: changeStatus

 public function changeStatus(Article $article)
 {
     if ($article->stat == 1) {
         $article->update(['stat' => 0]);
         Flash::success(trans('admin/messages.articleBan'));
     } elseif ($article->stat == 0) {
         $article->update(['stat' => 1]);
         Flash::success(trans('admin/messages.articleActivate'));
     }
     return redirect()->back();
 }
开发者ID:emadmrz,项目名称:Hawk,代码行数:11,代码来源:ArticleManagementController.php

示例2: update

 /**
  * Update the specified resource in storage.
  *
  * @param  ArticleRequest  $request
  * @param  Article $article
  * @return Response
  */
 public function update(ArticleRequest $request, Article $article)
 {
     $article->update($request->all());
     $article->tags()->sync($request->get('tag_list'));
     session()->flash('success', 'Запись ' . $request->get('title') . ' обновлена');
     return redirect()->route('article.index');
 }
开发者ID:belhard-user,项目名称:group2,代码行数:14,代码来源:BlogController.php

示例3: update

 /**
  * @param $id
  * @param ArticleRequest $request
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function update(Article $article, ArticleRequest $request)
 {
     //$article = Article::findOrFail($id); // Without Binding - Method should have $id param
     $article->update($request->all());
     $this->syncTags($article, $request->input('tag_list'));
     return redirect('articles');
 }
开发者ID:HarrisonPheeney,项目名称:Laracasts,代码行数:12,代码来源:ArticlesController.php

示例4: update

 public function update(Article $article, ArticleRequest $request)
 {
     $article->update($request->all());
     $article->tags()->sync($request->input('tag_list', []));
     \Flash::success('記事を更新しました。');
     return redirect()->route('articles.show', [$article->id]);
 }
开发者ID:ry-htr,项目名称:laravel-sample,代码行数:7,代码来源:ArticlesController.php

示例5: update

 public function update(Article $article, ArticleRequest $request)
 {
     $article->update($request->all());
     $this->syncTags($article, $request->input('tag_list'));
     flash()->success('Your article has been updated!');
     return redirect('article');
 }
开发者ID:jhernandes,项目名称:learning-laravel-5,代码行数:7,代码来源:ArticleController.php

示例6: update

 /**
  * Update an existing article.
  * 
  * @return Response
  */
 public function update(Article $article, Requests\ArticleRequest $request)
 {
     //   $article = Article::findOrFail($id);
     $article->update($request->all());
     $this->syncTags($article, $request->input('tag_list'));
     return redirect('articles');
 }
开发者ID:jimmylorunning,项目名称:learning-laravel-5,代码行数:12,代码来源:ArticlesController.php

示例7: update

 public function update(Article $article, Requests\ArticleRequest $request)
 {
     //type hinting ArticleRequest lets us do validation
     //$article = Article::findOrFail($id);
     $article->update($request->all());
     $article->tags()->sync($request->input('tag_list'));
     return redirect('articles');
 }
开发者ID:bartolini69,项目名称:Laracast-Tutorials,代码行数:8,代码来源:ArticlesController.php

示例8: update

 public function update(Article $article, ArticleRequest $request)
 {
     $article->update($request->all());
     $this->syncTags($article, $request->input('tag_list'));
     //$article->tags()->attach($request->input('tag_list')); // Prida do pivot table.
     //$article->tags()->dettach($request->input('tag_list')); // Odoberie z pivot table.
     return redirect('articles');
 }
开发者ID:smartedge,项目名称:Laravel,代码行数:8,代码来源:ArticlesController.php

示例9: update

 public function update(Article $article, ArticleRequest $request)
 {
     // $article = Article::findOrFail($id);
     $article->update($request->all());
     \Session::flash('flash_message', '記事を更新しました。');
     // return redirect(url('articles', [$article->id]));
     return redirect()->route('articles.show', [$article->id]);
 }
开发者ID:akokubu,项目名称:laravel_sample,代码行数:8,代码来源:ArticlesController.php

示例10: update

 /**
  * @param Article $article
  * @param ArticleRequest $request
  * @return Redirect
  * @internal param $id
  */
 public function update(Article $article, ArticleRequest $request)
 {
     $article->update($request->all());
     $this->syncTags($article, $request->input('tag_list'));
     //        $article->tags()->detach(Tag::lists('id')->toArray());
     //        $article->tags()->attach($request->input('tag_list'));
     //        $article->tags()->sync($request->input('tag_list'));
     return redirect('articles');
 }
开发者ID:sabahtalateh,项目名称:laracast,代码行数:15,代码来源:ArticlesController.php

示例11: article

 public function article(Request $request, Article $article)
 {
     $user = Auth::user();
     $comment = $article->comments()->create(['user_id' => $user->id, 'body' => $request->input('body')]);
     $article->update(['num_comment' => $article->comments()->count()]);
     $this->stream($comment);
     Flash::success(trans('message.articleCommentAdded'));
     return redirect()->back();
 }
开发者ID:emadmrz,项目名称:Hawk,代码行数:9,代码来源:CommentController.php

示例12: update

 public function update(ArticleRequest $request, Article $article)
 {
     $article->update($request->all());
     session()->flash('flash_message', 'Article was updated with success');
     if (Request::wantsJson()) {
         return $article;
     }
     return redirect('articles');
 }
开发者ID:jp7internet,项目名称:laravel-apz,代码行数:9,代码来源:ArticlesController.php

示例13: update

 /**
  * Update an article.
  *
  * @param CreateArticleRequest $request
  * @param Article $article
  * @return Response
  */
 public function update(CreateArticleRequest $request, Article $article)
 {
     $article->update($request->all());
     $tag_list = $request->input('tag_list');
     if (!empty($tag_list)) {
         $this->syncTags($article, $request->input('tag_list'));
     }
     return redirect()->route('admin.articles.index');
 }
开发者ID:maherelgamil,项目名称:ketabat,代码行数:16,代码来源:ArticlesController.php

示例14: update

 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(ArticleRequest $request, Article $article)
 {
     $input = $request->all();
     $article->update(['title' => $input['title'], 'body' => $input['body'], 'excerpt' => $input['excerpt']]);
     if ($request->ajax() || $request->wantsJson()) {
         return new JsonResponse($article);
     }
     flash()->success('aggiornato con successo!');
     return redirect('articles');
 }
开发者ID:Bluedusk96,项目名称:laravel-users-example,代码行数:17,代码来源:ArticlesController.php

示例15: update

 public function update(Article $article, ArticleRequest $request)
 {
     $article->update($request->all());
     $article->articleImages()->delete();
     if (count($request->eyecatch) > 0) {
         foreach ($request->eyecatch as $key => $eyecatch) {
             $articleImage = new ArticleImage(['eyecatch' => $eyecatch]);
             $article->articleImages()->save($articleImage);
         }
     }
     $article->tags()->sync($request->input('tag_list', []));
     \Flash::success('記事を更新しました。');
     // return redirect()->route('articles.show', [$article->id]);
 }
开发者ID:kittaka1222takashi,项目名称:dokoiko,代码行数:14,代码来源:ArticlesController.php


注:本文中的app\Article::update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。