修改更新方法

This commit is contained in:
wuyanwen 2020-01-17 15:49:42 +08:00
parent 8b216f2bc4
commit 9c7a01406d

View File

@ -24,12 +24,13 @@ trait BaseOptionsTrait
* @time 2019年12月03日 * @time 2019年12月03日
* @param $id * @param $id
* @param $data * @param $data
* @param string $field
* @return bool * @return bool
*/ */
public function updateBy($id, $data) public function updateBy($id, $data, $field = ''): bool
{ {
if (static::update($data, [$this->getPk() => $id], $this->field)) { if (static::update($data, [$field ? : $this->getPk() => $id], $this->field)) {
return true; return true;
} }