public function getItems(): array
    {
        $available = [];
        $assigned = [];

        foreach (array_keys($this->manager->getRoles()) as $name) {
            $available[$name] = 'role';
        }

        foreach (array_keys($this->manager->getPermissions()) as $name) {
            if ($name[0] != '/') {
                $available[$name] = 'permission';
            }
        }

        foreach ($this->manager->getAssignments($this->userId) as $item) {
            $assigned[$item->roleName] = $available[$item->roleName];
            unset($available[$item->roleName]);
        }

        return [
            'available' => $available,
            'assigned' => $assigned,
        ];
    }
public function getItems(): array
    {
        $available = [];
        $assigned = [];

        foreach (array_keys($this->manager->getRoles()) as $name) {
            $available[$name] = 'role';
        }

        foreach (array_keys($this->manager->getPermissions()) as $name) {
            if ($name[0] != '/') {
                $available[$name] = 'permission';
            }
        }

        foreach ($this->manager->getAssignments($this->userId) as $item) {
            $assigned[$item->roleName] = $available[$item->roleName];
            unset($available[$item->roleName]);
        }

        return [
            'available' => $available,
            'assigned' => $assigned,
        ];
    }
public function getItems ( ) : array { $ available = [ ] ; $ assigned = [ ] ; foreach ( array_keys ( $ this -> manager -> getRoles ( ) ) as $ name ) { $ available [ $ name ] = 'role' ; } foreach ( array_keys ( $ this -> manager -> getPermissions ( ) ) as $ name ) { if ( $ name [ 0 ] != '/' ) { $ available [ $ name ] = 'permission' ; } } foreach ( $ this -> manager -> getAssignments ( $ this -> userId ) as $ item ) { $ assigned [ $ item -> roleName ] = $ available [ $ item -> roleName ] ; unset ( $ available [ $ item -> roleName ] ) ; } return [ 'available' => $ available , 'assigned' => $ assigned , ] ; }
Get all available and assigned roles and permissions

@return array
Get all available and assigned roles and permissions