\think\model\concernSoftDelete

数据软删除

Summary

Methods
Properties
Constants
trashed()
withTrashed()
onlyTrashed()
delete()
destroy()
restore()
No public properties found
No constants found
withTrashedData()
getWithTrashedExp()
getDeleteTimeField()
withNoTrashed()
$withTrashed
N/A
No private methods found
No private properties found
N/A

Properties

$withTrashed

$withTrashed : boolean

是否包含软删除数据

Type

boolean

Methods

trashed()

trashed() : boolean

判断当前实例是否被软删除

Returns

boolean

withTrashed()

withTrashed() : \think\db\BaseQuery

查询软删除数据

Returns

\think\db\BaseQuery

onlyTrashed()

onlyTrashed() : \think\db\BaseQuery

只查询软删除数据

Returns

\think\db\BaseQuery

delete()

delete() : boolean

删除当前的记录

Returns

boolean

destroy()

destroy(mixed  $data, boolean  $force = false) : boolean

删除记录

Parameters

mixed $data

主键列表 支持闭包查询条件

boolean $force

是否强制删除

Returns

boolean

restore()

restore(array  $where = array()) : boolean

恢复被软删除的记录

Parameters

array $where

更新条件

Returns

boolean

withTrashedData()

withTrashedData(boolean  $withTrashed) : $this

是否包含软删除数据

Parameters

boolean $withTrashed

是否包含软删除数据

Returns

$this

getWithTrashedExp()

getWithTrashedExp() : array

获取软删除数据的查询条件

Returns

array

getDeleteTimeField()

getDeleteTimeField(boolean  $read = false) : string|false

获取软删除字段

Parameters

boolean $read

是否查询操作 写操作的时候会自动去掉表别名

Returns

string|false

withNoTrashed()

withNoTrashed(\think\db\BaseQuery  $query) : void

查询的时候默认排除软删除数据

Parameters

\think\db\BaseQuery $query