本文整理匯總了PHP中app\models\Article::update方法的典型用法代碼示例。如果您正苦於以下問題:PHP Article::update方法的具體用法?PHP Article::update怎麽用?PHP Article::update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\models\Article
的用法示例。
在下文中一共展示了Article::update方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: update
/**
* Update the specified resource in storage.
*
* @param Article $article
* @param ArticleRequest $request
* @return \Illuminate\Http\Response
*/
public function update(Article $article, ArticleRequest $request)
{
$article->update($request->all());
if ($tags = $request->get('tag_list')) {
$article->tags()->sync($tags);
}
flash()->success('Article has been edited!');
return Redirect::back();
}
示例2: update
/**
* Update the specified resource in storage.
*
* @param ArticleRequest $request
* @param Article $article
* @return Response
*/
public function update(ArticleRequest $request, Article $article)
{
$this->data = $article->update($request->all());
return $this->handleRedirect($request);
}
示例3: update
public function update(Article $article, ArticleRequest $request)
{
$article->update($request->all());
$this->syncTags($article, $request->input('tag_list'));
return redirect('articles');
}
示例4: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param Article $article
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $article)
{
$input = array_except($request->input(), array('_method', '_token', 'tagnames', 'destinations'));
$article->update($input);
return response()->redirectTo('/blog/' . $article->article_id);
}
示例5: updateArticle
/**
* Updates an article
* @param Article $article Article to update
* @return Response
*/
public function updateArticle($article)
{
$data = Input::all();
if ($article->validate($data)) {
$article->update($data);
return View::make('admin.articles.edit')->withArticle($article)->withSuccess('<strong>Article updated successfully.</strong>');
}
Input::flash();
return View::make('admin.articles.edit')->withArticle($article)->withErrors($article->getValidator());
}