Пример #1
0
 public function postComments()
 {
     $validator = Validator::make(Input::all(), Comment::$rules);
     if ($validator->passes()) {
         $comment = new Comment();
         $comment->post_id = Input::get('post_id');
         $comment->reply_from_id = Input::get('reply_from_id');
         $comment->user = Input::get('user');
         $comment->enabled = 0;
         $comment->email = Input::get('email');
         $comment->comment = Input::get('comment');
         $comment->save();
         return Redirect::back();
     }
     return Redirect::back()->withErrors($validator)->withInput();
 }
Пример #2
0
 public function postDestroy()
 {
     $comment = Comment::find(Input::get('id'));
     if ($comment) {
         $comment->delete();
         return Redirect::to('blog/admin/comments/index')->with('message', 'Comment Deleted');
     }
     return Redirect::to('blog/admin/comments/index')->with('message', 'Something went wrong, please try again');
 }