protected function _authorizeBlock(AnCommandContext $context)
    {
        if (is_guest($this->_viewer)) {
            return false;
        }

        //viewer can only block actor from following them if and only if actor is leadable (can follow ) and viewer is followable
        if (!$this->_entity->isLeadable()) {
            return false;
        }

        if ($this->_viewer->eql($this->_entity)) {
            return false;
        }

        //you can't block an admin
        if ($this->_entity->admin()) {
            return false;
        }

         //if entity is administrable and the viewer is one of the admins then it can not be blocked
        if (
            $this->_entity->isAdministrable() &&
            $this->_entity->administratorIds->offsetExists($this->_viewer->id)
        ) {
            return false;
        }

        return true;
    }
protected function _authorizeBlock(AnCommandContext $context)
    {
        if (is_guest($this->_viewer)) {
            return false;
        }

        //viewer can only block actor from following them if and only if actor is leadable (can follow ) and viewer is followable
        if (!$this->_entity->isLeadable()) {
            return false;
        }

        if ($this->_viewer->eql($this->_entity)) {
            return false;
        }

        //you can't block an admin
        if ($this->_entity->admin()) {
            return false;
        }

         //if entity is administrable and the viewer is one of the admins then it can not be blocked
        if (
            $this->_entity->isAdministrable() &&
            $this->_entity->administratorIds->offsetExists($this->_viewer->id)
        ) {
            return false;
        }

        return true;
    }
protected function _authorizeBlock ( AnCommandContext $ context ) { if ( is_guest ( $ this -> _viewer ) ) { return false ; } //viewer can only block actor from following them if and only if actor is leadable (can follow ) and viewer is followable if ( ! $ this -> _entity -> isLeadable ( ) ) { return false ; } if ( $ this -> _viewer -> eql ( $ this -> _entity ) ) { return false ; } //you can't block an admin if ( $ this -> _entity -> admin ( ) ) { return false ; } //if entity is administrable and the viewer is one of the admins then it can not be blocked if ( $ this -> _entity -> isAdministrable ( ) && $ this -> _entity -> administratorIds -> offsetExists ( $ this -> _viewer -> id ) ) { return false ; } return true ; }
If true then viewer can block the entity.

@param AnCommandContext $context Context parameter

@return bool
If true then viewer can block the entity .