/**
  * 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);
 }