public function roleLoadPermissions($roles)
    {
        if (!$roles) {
            return false;
        }
        $multi = is_array($roles);
        if (!$multi) {
            $roles = [$roles];
        }
        $permissions_ids = [];

        foreach ($roles as $role) {
            if (!is_array($role->_permission_ids)) {
                $role->_permission_ids = explode(',', $role->_permission_ids);
            }
            $permissions_ids = array_merge($permissions_ids, $role->_permission_ids);
        }
        $perms = $this->permissionFetchById($permissions_ids);
        foreach ($perms as $perm) {
            foreach ($roles as $role) {
                if (in_array($perm->permission_id, $role->_permission_ids)) {
                    $role->addPermission($perm);
                    continue;
                }
            }
        }
        return true;
    }
public function roleLoadPermissions($roles)
    {
        if (!$roles) {
            return false;
        }
        $multi = is_array($roles);
        if (!$multi) {
            $roles = [$roles];
        }
        $permissions_ids = [];

        foreach ($roles as $role) {
            if (!is_array($role->_permission_ids)) {
                $role->_permission_ids = explode(',', $role->_permission_ids);
            }
            $permissions_ids = array_merge($permissions_ids, $role->_permission_ids);
        }
        $perms = $this->permissionFetchById($permissions_ids);
        foreach ($perms as $perm) {
            foreach ($roles as $role) {
                if (in_array($perm->permission_id, $role->_permission_ids)) {
                    $role->addPermission($perm);
                    continue;
                }
            }
        }
        return true;
    }
public function roleLoadPermissions ( $ roles ) { if ( ! $ roles ) { return false ; } $ multi = is_array ( $ roles ) ; if ( ! $ multi ) { $ roles = [ $ roles ] ; } $ permissions_ids = [ ] ; foreach ( $ roles as $ role ) { if ( ! is_array ( $ role -> _permission_ids ) ) { $ role -> _permission_ids = explode ( ',' , $ role -> _permission_ids ) ; } $ permissions_ids = array_merge ( $ permissions_ids , $ role -> _permission_ids ) ; } $ perms = $ this -> permissionFetchById ( $ permissions_ids ) ; foreach ( $ perms as $ perm ) { foreach ( $ roles as $ role ) { if ( in_array ( $ perm -> permission_id , $ role -> _permission_ids ) ) { $ role -> addPermission ( $ perm ) ; continue ; } } } return true ; }
Load the full permission set into the role instance

@param $roles
@return bool|Role|Role[]
Load the full permission set into the role instance