public function set(string $id, array $cfg = null): int
  {
    return $this->db->update($this->class_cfg['table'], [
      $this->fields['cfg'] => $cfg ? json_encode($this->get_cfg(false, $cfg)) : null
    ], [
      $this->fields['id'] => $id
    ]);
  }
public function set(string $id, array $cfg = null): int
  {
    return $this->db->update($this->class_cfg['table'], [
      $this->fields['cfg'] => $cfg ? json_encode($this->get_cfg(false, $cfg)) : null
    ], [
      $this->fields['id'] => $id
    ]);
  }
public function set ( string $ id , array $ cfg = null ) : int { return $ this -> db -> update ( $ this -> class_cfg [ 'table' ] , [ $ this -> fields [ 'cfg' ] => $ cfg ? json_encode ( $ this -> get_cfg ( false , $ cfg ) ) : null ] , [ $ this -> fields [ 'id' ] => $ id ] ) ; }
Sets the permission config for the current user by the preference's ID

@param string $id
@param array $cfg
@return int
Sets the permission config for the current user by the preference s ID