修改更新方法
This commit is contained in:
parent
8b216f2bc4
commit
9c7a01406d
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user