當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。