Пример #1
0
 /**
  * @param $id
  */
 public static function delete($id)
 {
     $comment = Comments::findByPK($id);
     if (!Request::is_authenticated()) {
         Response::redirect('');
     } else {
         if (Request::user()->id !== $comment['id_account'] and !Request::is_admin()) {
             Session::push('flash-message', 'You does not have permission to delete the other Member\'s post!');
             Response::redirect('');
         }
     }
     # perform the post deletion
     Comments::delete($id);
     # redirect to main page
     Response::redirect('');
 }