--------------------------------------------
$relation = model('Relation');
$like = $relation->withTrashed()->buildSql();
halt($like);
----------------------------------------------
string(73) "( SELECT * FROM `xin_relation` WHERE `xin_relation`.`deltime` IS NULL )"
##############################
-------------------------
\thinkphp\library\traits\model\SoftDelete.php
-------------------------
/**
* 查询软删除数据
* @access public
* @return \think\db\Query
*/
public static function withTrashed()
{
$model = new static();
return $model->db();
}
protected function ba
{
$field = $this->getDeleteTimeField(true);
$query->where($field, 'null');
}
最佳答案