Esempio n. 1
0
 /**
  * Update an existing post.
  *
  * @param int $id
  *
  * @return \Illuminate\Http\Response
  */
 public function update($id)
 {
     $input = Binput::only(['title', 'summary', 'body']);
     $val = PostRepository::validate($input, array_keys($input));
     if ($val->fails()) {
         return Redirect::route('blog.posts.edit', ['posts' => $id])->withInput()->withErrors($val->errors());
     }
     $post = PostRepository::find($id);
     $this->checkPost($post);
     $post->update($input);
     return Redirect::route('blog.posts.show', ['posts' => $post->id])->with('success', 'Your post has been updated successfully.');
 }