/**
  *  stores a new Article in the database
  *
  * @param ArticleRequest $request
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function store(ArticleRequest $request)
 {
     $article = new Article($request->all());
     Auth::user()->articles()->save($article);
     $article->tags()->attach($request->input('tag_list'));
     return redirect('articles')->with(['flash_message' => 'The Article has been published!', 'flash_message_important' => true]);
 }
 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;
 }
 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]);
 }
示例#4
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]);
 }
 public function update($id, ArticleRequest $request)
 {
     $article = Article::findOrFail($id);
     $article->tags()->sync($request->input('tag_list'));
     $article->update($request->all());
     return redirect('articles');
 }
 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;
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param ArticleRequest|Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(ArticleRequest $request)
 {
     $article = Auth::user()->articles()->create($request->all());
     /* @var $article Article */
     $article->tags()->attach($request->input('tag_list'));
     flash()->success('Article has been created!');
     return redirect('admin\\article');
 }
 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');
 }
 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;
 }
 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');
 }
 public function store(ArticleRequest $request)
 {
     $article = Auth::user()->articles()->create($request->all());
     $tagIds = $request->input('tag_list');
     $article->tags()->attach($tagIds);
     flash()->overlay('Your article has been created', 'Good Job');
     return redirect('articles');
 }
 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;
 }
 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');
 }
示例#14
0
 /**
  * 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');
 }
示例#15
0
 /**
  * Save a new article
  * @param  ArticleRequest $request
  * @return mixed
  */
 private function createArticle(ArticleRequest $request)
 {
     $user = Sentinel::getUser();
     $articleCredentials = ['title' => strtolower($request->get('title')), 'user_id' => $user->id, 'lang' => $request->get('lang'), 'body' => $request->get('body'), 'published_at' => $request->get('published_at')];
     $article = Article::create($articleCredentials);
     $tags = (array) $request->input('tag_list');
     if (count($tags)) {
         $this->syncTags($article, $tags);
     }
     return $article;
 }
示例#16
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(ArticleRequest $request, $id)
 {
     $article = Article::findOrFail($id);
     $input = $request->all();
     $input['img'] = !empty($request->input('image')[0]['img']) ? $request->input('image')[0]['img'] : '';
     $request->replace($input);
     $article->update($request->all());
     $article->updateCat(['cat' => $request->input('cat'), 'id' => $id]);
     //dump($request->input('image'));
     $article->images()->delete();
     foreach ($request->input('image') as $img) {
         $article->images()->create(array_add($img, 'article_id', $id));
     }
     Cache::flush();
     flash()->success(trans('articles.article_updated'));
     return redirect(action('Admin\\ArticlesController@index'));
 }
示例#17
0
 /**
  * Update an article
  *
  * @param $id
  * @param Request $request
  * @return $this|void
  */
 public function update(Article $article, ArticleRequest $request)
 {
     //validation
     //        if($request->user()->can('update-article', $article))
     $this->authorize('update-article', $article);
     $article->update($request->all());
     $this->syncTags($article, $request->input('tag_list'));
     return redirect('articles');
 }
 public function update($id, ArticleRequest $request)
 {
     $article = Auth::user()->articles()->where('id', $id)->firstOrFail();
     $article->update($request->all());
     $article->tags()->sync($request->input('tag_list'));
     // sync():上書き
     return redirect('articles');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($slug, ArticleRequest $request)
 {
     $article = Article::where('slug', '=', $slug)->first();
     $article->update($request->all());
     $article->tags()->sync($request->input('tag_list'));
     return redirect('/article');
 }
 public function update(ArticleRequest $request, Article $article)
 {
     $article->update($request->all());
     $article->tags()->sync(!$request->input('taglist') ? [] : $request->input('taglist'));
     return redirect('/articles/' . $article->id);
 }
示例#21
0
 /**
  * update an existing article
  *
  * @param  integer $id
  * @param  ArticleRequest $request
  * @return Response
  */
 public function update(Article $article, ArticleRequest $request)
 {
     $article->update($request->except('image'));
     $article->slug = str_slug($request->title, '-');
     if ($request->hasFile('image')) {
         $file = $request->file('image');
         $filename = $file->getClientOriginalName();
         $extension = $file->getClientOriginalExtension();
         $image = sha1($filename . time()) . '.' . $extension;
         $destinationPath = public_path('/uploads/images/');
         $request->file('image')->move($destinationPath, $image);
         $article->image = $image;
     }
     $article->update();
     $this->syncTags($article, $request->input('tag_list'));
     flash()->info('Artikel telah diperbarui!');
     return redirect('/dashboard/articles');
 }
 /**
  * Save a new article.
  */
 private function createArticle(ArticleRequest $request)
 {
     $article = \Auth::user()->articles()->create($request->all());
     $article->tags()->attach($request->input('tag_list'));
     return $article;
 }
示例#23
0
 /**
  * Update article method.
  *
  * @param ArticleRequest $request
  * @param Article $article
  * @return Article
  */
 private function updateArticle(ArticleRequest $request, Article $article)
 {
     $article->update($request->all());
     $this->syncTags($article, $request->input('tag_list', []));
     return $article;
 }
示例#24
0
 /**
  * Save a new article.
  *
  * @param ArticleRequest $request
  * @return mixed
  */
 private function createArticle(ArticleRequest $request)
 {
     $article = Auth::user()->articles()->create($request->all());
     $this->syncTags($article, $request->input('tag_list'));
     return $article;
 }
 /**
  * @param ArticleRequest $request
  */
 public function createArticle(ArticleRequest $request)
 {
     $article = \Auth::user()->articles()->create($request->all());
     $this->syncTags($article, $request->input('tag_list'));
 }
示例#26
0
 private function createArticle(ArticleRequest $request)
 {
     // $images = $request->file('images');
     // foreach($images as $key => $image):
     //   $imageName = time() .'_('.$key.').'. $image->getClientOriginalExtension();
     //   $imagePath = 'files/images/'.$imageName;
     //   $nameStore .= $imageName.",";
     //   $pathStore .= $imagePath.",";
     // $media = Image::make($image);
     // $media->save($imagePath);
     // endforeach;
     $article = Auth::user()->articles()->create($request->all());
     $article->tags()->attach($request->input('tag_list'));
     return $article;
 }
 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]);
 }
 /**
  * update an existing article
  *
  * @param  integer $id
  * @param  ArticleRequest $request
  * @return Response
  */
 public function update(Article $article, ArticleRequest $request)
 {
     $article->update($request->all());
     $this->syncTags($article, $request->input('tag_list'));
     return redirect('articles');
 }
示例#29
0
 public function update(Article $article, ArticleRequest $request)
 {
     $article->update($request->all());
     $article->tags()->sync($request->input("tag_list"));
     return redirect('articles');
 }
 /**
  * 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::findOrFail($id);
     if (Permissions::check('article.edit') or Permissions::check('article.editown') and $article->user_id == Auth::user()->id and $article->published == 0) {
         $article->title = $request->input('title');
         $article->slug = $request->input('slug');
         $article->temporary_jumbo_image = $request->input('temporary_jumbo_image');
         $article->store = $request->input('store');
         $article->store_app_id = $request->input('store_app_id');
         $article->subreddit = $request->input('subreddit');
         $article->score = $request->input('score');
         $article->titletext = $request->input('titletext');
         $article->score_text_md = $request->input('score_text_md');
         $article->gameplay_md = $request->input('gameplay_md');
         $article->story_md = $request->input('story_md');
         $article->graphics_md = $request->input('graphics_md');
         $article->conclusion_md = $request->input('conclusion_md');
         $article->screenshots_md = $request->input('screenshots_md');
         $article->intro_md = $request->input('intro_md');
         //actual fields
         $article->score_text = Markdown::convertToHtml($request->input('score_text_md'));
         $article->gameplay = Markdown::convertToHtml($request->input('gameplay_md'));
         $article->story = Markdown::convertToHtml($request->input('story_md'));
         $article->graphics = Markdown::convertToHtml($request->input('graphics_md'));
         $article->conclusion = Markdown::convertToHtml($request->input('conclusion_md'));
         $article->screenshots = Markdown::convertToHtml($request->input('screenshots_md'));
         $article->intro = Markdown::convertToHtml($request->input('intro_md'));
         $article->save();
         $screenshots = array();
         if ($request->input('screenshot') != null) {
             foreach ($request->input('screenshot') as $key => $screenshot) {
                 $screenshots[$key]['image_id'] = $screenshot;
                 $screenshots[$key]['article_id'] = $article->id;
                 $screenshots[$key]['ip_address'] = inet_pton($request->getClientIp());
             }
         }
         ArticleScreenshot::insert($screenshots);
         return redirect()->action('ArticleController@show', [$article->slug]);
     }
     abort(403);
 }