app\models\Menu::isDeletable PHP Method

isDeletable() public method

public isDeletable ( ) : boolean
return boolean
    public function isDeletable()
    {
        // Protect the root menu from deletion
        if ('root' == $this->name) {
            return false;
        }
        // Fix #32: Prevent deletion of nodes with children
        $children = $this->children();
        if ($children && $children->count() > 0) {
            return false;
        }
        return true;
    }