修改更新方法

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

View File

@ -19,17 +19,18 @@ trait BaseOptionsTrait
return false; return false;
} }
/** /**
* *
* @time 2019年12月03日 * @time 2019年12月03日
* @param $id * @param $id
* @param $data * @param $data
* @return bool * @param string $field
*/ * @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;
} }