This commit is contained in:
2020-09-11 17:58:02 +08:00
parent 2d789b3494
commit 45aaf011f9
7 changed files with 66 additions and 48 deletions
+16
View File
@@ -189,6 +189,22 @@ class Columns extends Component
return $this->_primary[$this->table] ?? null;
}
/**
* @return array|null|string
*
* @throws Exception
*/
public function getFirstPrimary()
{
if (isset($this->_auto_increment[$this->table])) {
return $this->_auto_increment[$this->table];
}
if (isset($this->_primary[$this->table])) {
return current($this->_primary[$this->table]);
}
return null;
}
/**
* @param $name
* @param null $index