本文整理汇总了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();
}
示例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');
}
示例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');
}
示例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]);
}
示例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');
}
示例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');
}
示例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');
}
示例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');
}
示例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]);
}
示例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');
}
示例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();
}
示例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');
}
示例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');
}
示例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');
}
示例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]);
}