public function status($id, $status)
    {
        if (in_array($status, ['pending', 'approved', 'spam', 'trash'])) {
            $this->loadModel('Comment.Comments');
            if ($comment = $this->Comments->get($id)) {
                $comment->set('status', $status);
                $this->Comments->save($comment);
            }
        }

        $this->title(__d('comment', 'Change Comment Status'));
        $this->redirect($this->referer());
    }
public function status($id, $status)
    {
        if (in_array($status, ['pending', 'approved', 'spam', 'trash'])) {
            $this->loadModel('Comment.Comments');
            if ($comment = $this->Comments->get($id)) {
                $comment->set('status', $status);
                $this->Comments->save($comment);
            }
        }

        $this->title(__d('comment', 'Change Comment Status'));
        $this->redirect($this->referer());
    }
public function status ( $ id , $ status ) { if ( in_array ( $ status , [ 'pending' , 'approved' , 'spam' , 'trash' ] ) ) { $ this -> loadModel ( 'Comment.Comments' ) ; if ( $ comment = $ this -> Comments -> get ( $ id ) ) { $ comment -> set ( 'status' , $ status ) ; $ this -> Comments -> save ( $ comment ) ; } } $ this -> title ( __d ( 'comment' , 'Change Comment Status' ) ) ; $ this -> redirect ( $ this -> referer ( ) ) ; }
Changes the status of the given comment.

@param int $id Comment id
@param string $status New status for the comment
@return void Redirects to previous page
Changes the status of the given comment .