Esempio n. 1
0
 /**
  * Store a new post.
  *
  * @return \Illuminate\Http\Response
  */
 public function store()
 {
     $input = array_merge(['user_id' => Credentials::getuser()->id], Binput::only(['title', 'summary', 'body']));
     $val = PostRepository::validate($input, array_keys($input));
     if ($val->fails()) {
         return Redirect::route('blog.posts.create')->withInput()->withErrors($val->errors());
     }
     $post = PostRepository::create($input);
     return Redirect::route('blog.posts.show', ['posts' => $post->id])->with('success', 'Your post has been created successfully.');
 }