trait SoftDeleteTrait

Trait SoftDeleteTrait to be used in Models, requires deleted_at column in database table

Assumes presence of these members

Properties

Controller read-only $mod
array read-only $properties
string read-only $table_name

Provides the methods:

Methods

_scopeNotDeleted(Query $query)

No description

_scopeSoftDeleted(Query $query)

No description

bool
canForceDelete()

Makes sure the soft delete minimum keep duration is observed.

bool
forceDelete($force = false)

Will execute standard model delete method.

int
getSoftDeleteKeepDays()

Returns how many days the soft deleted documents are kept.

initSoftDeleteTrait()

No description

bool
isSoftDeleted()

No description

onForceDelete()

No description

onRestore()

Implement to process event

onSoftDelete()

Implement to process event

restore()

Recover soft deleted item

scopeNotDeleted()

Default active scope.

scopeSoftDeleted()

Scope to return only soft deleted records.

int|bool|null
softDelete()

Mark this model as deleted by setting deleted_at to current time

withDeleted()

No description

Details

at line 34
_scopeNotDeleted(Query $query)

No description

Parameters

Query $query

at line 40
_scopeSoftDeleted(Query $query)

No description

Parameters

Query $query

at line 135
bool canForceDelete()

Makes sure the soft delete minimum keep duration is observed.

e.g. document was deleted 30 days ago, but the keep duration was increased to 120 days.

Return Value

bool

at line 73
bool forceDelete($force = false)

Will execute standard model delete method.

Parameters

$force

Return Value

bool

at line 124
int getSoftDeleteKeepDays()

Returns how many days the soft deleted documents are kept.

Return Value

int

at line 30
initSoftDeleteTrait()

No description

at line 107
bool isSoftDeleted()

No description

Return Value

bool

at line 154
onForceDelete()

No description

at line 152
onRestore()

Implement to process event

at line 147
onSoftDelete()

Implement to process event

at line 91
restore()

Recover soft deleted item

at line 28
ModelCollection scopeNotDeleted()

Default active scope.

Return Value

ModelCollection

at line 28
ModelCollection scopeSoftDeleted()

Scope to return only soft deleted records.

Return Value

ModelCollection

at line 54
int|bool|null softDelete()

Mark this model as deleted by setting deleted_at to current time

Return Value

int|bool|null

at line 46
withDeleted()

No description