mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
修正软删除的withTrashed方法 Query类增加removeWhereField方法
This commit is contained in:
@@ -938,6 +938,22 @@ class Query
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 去除某个查询条件
|
||||||
|
* @access public
|
||||||
|
* @param string $field 查询字段
|
||||||
|
* @param string $logic 查询逻辑 and or xor
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function removeWhereField($field, $logic = 'AND')
|
||||||
|
{
|
||||||
|
$logic = strtoupper($logic);
|
||||||
|
if (isset($this->options['where'][$logic][$field])) {
|
||||||
|
unset($this->options['where'][$logic][$field]);
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 指定查询数量
|
* 指定查询数量
|
||||||
* @access public
|
* @access public
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ trait SoftDelete
|
|||||||
public static function withTrashed()
|
public static function withTrashed()
|
||||||
{
|
{
|
||||||
$model = new static();
|
$model = new static();
|
||||||
return $model->db(false);
|
$field = $model->getDeleteTimeField(true);
|
||||||
|
return $model->db(false)->removeWhereField($field);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user