软删除restore方法支持传入条件

This commit is contained in:
thinkphp
2016-09-13 22:02:26 +08:00
parent 9c227e9e8e
commit 3e79ff0c28

View File

@@ -101,16 +101,15 @@ trait SoftDelete
/**
* 恢复被软删除的记录
* @access public
* @param array $where 更新条件
* @return integer
*/
public function restore()
public function restore($where = [])
{
if (static::$deleteTime) {
// 恢复删除
$name = static::$deleteTime;
$this->change[] = $name;
$this->data[$name] = null;
return $this->isUpdate()->save();
$name = static::$deleteTime;
return $this->isUpdate()->save([$name => null], $where);
}
return false;
}
@@ -118,6 +117,7 @@ trait SoftDelete
/**
* 查询默认不包含软删除数据
* @access protected
* @param \think\db\Query $query 查询对象
* @return void
*/
protected static function base($query)