protected function _authorizeUnfollow(AnCommandContext $context)
    {
        //if the viewer is not following then return false;
        //Riddle : How can you unfollow an actor that you are not following
        if (!$this->_viewer->following($this->_entity)) {
            return false;
        }

        //if entity is adminitrable and the viewer is an admin and there are only one admin. then the viewer can't unfollow
        if (
            $this->_entity->isAdministrable() &&
            $this->_entity->administratorIds->offsetExists($this->_viewer->id)
        ) {
            return ($this->_entity->administratorIds->count() >= 2);
        }

        return true;
    }
protected function _authorizeUnfollow(AnCommandContext $context)
    {
        //if the viewer is not following then return false;
        //Riddle : How can you unfollow an actor that you are not following
        if (!$this->_viewer->following($this->_entity)) {
            return false;
        }

        //if entity is adminitrable and the viewer is an admin and there are only one admin. then the viewer can't unfollow
        if (
            $this->_entity->isAdministrable() &&
            $this->_entity->administratorIds->offsetExists($this->_viewer->id)
        ) {
            return ($this->_entity->administratorIds->count() >= 2);
        }

        return true;
    }
protected function _authorizeUnfollow ( AnCommandContext $ context ) { //if the viewer is not following then return false; //Riddle : How can you unfollow an actor that you are not following if ( ! $ this -> _viewer -> following ( $ this -> _entity ) ) { return false ; } //if entity is adminitrable and the viewer is an admin and there are only one admin. then the viewer can't unfollow if ( $ this -> _entity -> isAdministrable ( ) && $ this -> _entity -> administratorIds -> offsetExists ( $ this -> _viewer -> id ) ) { return ( $ this -> _entity -> administratorIds -> count ( ) >= 2 ) ; } return true ; }
Checks whether the viewer can unfollow the actor.

@param AnCommandContext $context Context parameter

@return bool
Checks whether the viewer can unfollow the actor .