mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
软删除restore方法支持传入条件
This commit is contained in:
@@ -101,16 +101,15 @@ trait SoftDelete
|
|||||||
/**
|
/**
|
||||||
* 恢复被软删除的记录
|
* 恢复被软删除的记录
|
||||||
* @access public
|
* @access public
|
||||||
|
* @param array $where 更新条件
|
||||||
* @return integer
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function restore()
|
public function restore($where = [])
|
||||||
{
|
{
|
||||||
if (static::$deleteTime) {
|
if (static::$deleteTime) {
|
||||||
// 恢复删除
|
// 恢复删除
|
||||||
$name = static::$deleteTime;
|
$name = static::$deleteTime;
|
||||||
$this->change[] = $name;
|
return $this->isUpdate()->save([$name => null], $where);
|
||||||
$this->data[$name] = null;
|
|
||||||
return $this->isUpdate()->save();
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -118,6 +117,7 @@ trait SoftDelete
|
|||||||
/**
|
/**
|
||||||
* 查询默认不包含软删除数据
|
* 查询默认不包含软删除数据
|
||||||
* @access protected
|
* @access protected
|
||||||
|
* @param \think\db\Query $query 查询对象
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected static function base($query)
|
protected static function base($query)
|
||||||
|
|||||||
Reference in New Issue
Block a user