コード例 #1
0
 /**
  * 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->input('tag_list', []));
     Flash::success(trans('message.entity_updated', ['entity' => trans('models.article')]));
     return redirect()->route('admin.articles.edit', ['id' => $article->id]);
 }
コード例 #2
0
 public function store(ArticleRequest $request)
 {
     Article::create($request->all());
     session()->flash('success', 'Новость добавлена');
     // $_SESSION['success'] = 'Новость добавлена'
     return redirect()->route('main');
 }
コード例 #3
0
 /**
  * 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');
 }
コード例 #4
0
 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
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Requests\ArticleRequest $request, $id)
 {
     $article = Article::findOrFail($id);
     $article->update($request->all());
     $article->tags()->sync($request->get('tag_list', []));
     return redirect()->action('Goenitz\\ArticleController@index');
 }
コード例 #6
0
 private function createArticle(ArticleRequest $request)
 {
     //Create an article with the attributes from the form
     $article = Auth::user()->articles()->create($request->all());
     $this->syncTags($article, $request->input('tag_list'));
     return $article;
 }
コード例 #7
0
 public function store(ArticleRequest $request)
 {
     // Auth::user()->articles returns collection
     $article = Auth::user()->articles()->create($request->all());
     $article->tags()->attach($request->input('tag_list'));
     return redirect('articles')->with(['flash_message' => 'Your article has been created', 'flash_message_important' => true]);
 }
コード例 #8
0
 public function update($id, ArticleRequest $request)
 {
     $article = Article::findOrFail($id);
     $article->tags()->sync($request->input('tag_list'));
     $article->update($request->all());
     return redirect('articles');
 }
コード例 #9
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(ArticleRequest $request, $id)
 {
     $article = Article::find($id);
     $article->fill($request->all());
     $article->save();
     return redirect()->route('admin.articles.index')->with('message', 'Se ha editado ' . $article->name . ' de forma correcta.');
 }
コード例 #10
0
 public function update(ArticleRequest $request, $id)
 {
     $article = Article::findOrFail($id);
     $article->update($request->all());
     session()->flash('flash_message', 'Article Updated!');
     return redirect('/articles');
 }
コード例 #11
0
 public function store(ArticleRequest $request)
 {
     //Automatic Validation because of App\Http\Requests\CreateArticleRequest
     $article = new Article($request->all());
     \Auth::user()->articles()->save($article);
     //Article::create($request->all());
     return redirect('articles');
 }
コード例 #12
0
 private function createArticle(ArticleRequest $request)
 {
     $article = new Article($request->all());
     $article_id = Auth::user()->articles()->save($article);
     //returns id of article
     $this->syncTags($article_id, $request->input('tag_list'));
     return $article_id;
 }
コード例 #13
0
 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]);
 }
コード例 #14
0
 private function createArticle(ArticleRequest $request)
 {
     $article = \Auth::user()->articles()->create($request->all());
     $tagIds = $request->input("taglist");
     //returns array of submitted ids of tags
     $article->tags()->attach($tagIds);
     return $article;
 }
コード例 #15
0
 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');
 }
コード例 #16
0
 public function update(Requests\ArticleRequest $request, $id)
 {
     $article = Article::findOrFail($id);
     $article->update($request->all());
     $article->tags()->sync($request->input('tag_list'));
     // sync - delete old & add new tags
     return redirect('articles');
 }
コード例 #17
0
 private function createArticle(Requests\ArticleRequest $request)
 {
     $article = new Article($request->all());
     $article = Auth::user()->articles()->save($article);
     $tagIds = $request->input('tag_list');
     $this->syncTags($article, $tagIds);
     return $article;
 }
コード例 #18
0
 public function newArticle(ArticleRequest $request)
 {
     $user = Auth::user();
     $article = new Article($request->all());
     $article->user_id = $user->id;
     $article->save();
     Auth::user()->articles()->save($article);
     $user->save();
 }
コード例 #19
0
 /**
  * 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();
 }
コード例 #20
0
 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');
 }
コード例 #21
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, ArticleRequest $request)
 {
     $article = Article::findOrFail($id);
     $article->fill($request->all());
     $article->modified_by = Auth::user()->id;
     $article->save();
     flash()->success('Article Updated');
     return redirect('articles');
 }
コード例 #22
0
ファイル: WindController.php プロジェクト: 2zH/wind.moe
 public function update($id, ArticleRequest $request)
 {
     if (\Auth::guest()) {
         return redirect('article');
     }
     $article = Article::findOrFail($id);
     $article['updated_at'] = Carbon::now('Asia/Shanghai');
     $article->update($request->all());
     return redirect('article');
 }
コード例 #23
0
ファイル: ArticleController.php プロジェクト: abada/GermyCMS
 /**
  * Update the specified resource in storage.
  *
  * @param  int $id
  * @return Response
  */
 public function update(ArticleRequest $request, Article $article)
 {
     if ($article->update($request->all())) {
         Flash::success('修改成功!');
         return View::make($this->getView('edit'))->withArticle($article);
     } else {
         Flash::error('修改失败!');
         return Redirect::back()->withInput();
     }
 }
コード例 #24
0
 /**
  * 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');
 }
コード例 #25
0
 public function update(Article $article, ArticleRequest $request)
 {
     $this->authorize('update', $article);
     $requests = $request->all();
     $this->articles->syncTags($article, $request->tag_list);
     $requests['comment_status'] = $request->comment_status ? $request->comment_status : 0;
     $requests['excerpt'] = $requests['excerpt'] ? $requests['excerpt'] : mb_content_filter_cut($requests['body']);
     $article->update($requests);
     Auth::user()->histories()->create(['type' => 'article', 'content' => '修改文章《<a href="/article/' . $article->id . '" target="_blank">' . $article->title . '</a>》']);
     flash()->message('文章修改成功!');
     return redirect('article/' . $article->id);
 }
コード例 #26
0
 public function store(ArticleRequest $request)
 {
     //Automatic Validation because of App\Http\Requests\CreateArticleRequest
     $article = new Article($request->all());
     \Auth::user()->articles()->save($article);
     //Article::create($request->all());
     $tagIds = $request->input('tag_list');
     $article->tags()->attach($tagIds);
     \Session::flash('flash_message', 'Your article has been created!');
     \Session::flash('flash_message_important', true);
     return redirect('articles');
 }
コード例 #27
0
ファイル: ArticlesController.php プロジェクト: realnerdo/blog
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(ArticleRequest $request)
 {
     $article = Auth::user()->articles()->create($request->all());
     $this->syncTags($article, $request->input('tag_list'));
     if ($request->hasFile('cover')) {
         $this->uploadFile($article, $request->file('cover'));
     }
     if ($request->has('twitter')) {
         $this->tweet($article);
     }
     session()->flash('flash_message', 'Se ha publicado tu artículo');
     return redirect('admin/articles');
 }
コード例 #28
0
 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]);
 }
コード例 #29
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  CreateArticleRequest  $request
  * @return \Illuminate\Http\Response
  */
 public function store(ArticleRequest $request)
 {
     $article = new Article($request->all());
     $article->setImage($request);
     $article->setThumbnail($request);
     $article->setPublishedAtAttribute(Carbon::now());
     Auth::user()->articles()->save($article);
     $article->tags()->attach($request->input('tag_list'));
     // sending back with message
     Session::flash('success', 'Created Article Successfully');
     // create the new article;
     // return to the index
     return Redirect('articles')->with('message', 'Article created');
 }
コード例 #30
0
 /**
  * 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'], 'codice_prodotto' => $input['codice_prodotto'], 'disponibile' => $input['disponibile'], 'prezzo' => $input['prezzo'], 'categoria' => $input['categoria']]);
     if ($request->file('immagine')) {
         $imageName = $article->id . '.' . $request->file('immagine')->getClientOriginalExtension();
         $request->file('immagine')->move(base_path() . '/public/images/catalog/', $imageName);
         $article->update(['immagine' => $imageName]);
     }
     if ($request->ajax() || $request->wantsJson()) {
         return new JsonResponse($article);
     }
     flash()->success('aggiornato con successo!');
     return redirect('articles');
 }