软删除

This commit is contained in:
thinkphp
2017-03-13 22:46:11 +08:00
parent 522009eaa3
commit 6e72edd354

View File

@@ -42,7 +42,8 @@ trait SoftDelete
{
$model = new static();
$field = $model->getDeleteTimeField(true);
return $model->db(false)->useSoftDelete($field, ['not null', '']);
return $model->db(false)
->useSoftDelete($field, ['not null', '']);
}
/**
@@ -116,7 +117,10 @@ trait SoftDelete
$where[$pk] = $this->getData($pk);
}
// 恢复删除
return $this->db(false)->useSoftDelete($name, ['not null', ''])->where($where)->update([$name => null]);
return $this->db(false)
->useSoftDelete($name, ['not null', ''])
->where($where)
->update([$name => null]);
}
/**