SoftDelete
Soft delete trait
Custom soft delete column name protected $softDeleteColumnName = ' column name '
Table of Contents
Properties
- $DEFAULT_SOFT_DELETE_COLUMN : string
- Default soft delete column mame
Methods
- clearDeleted() : bool
- Permanently delete all soft deleted models
- getDeletedCount() : int
- Get delete models count.
- getNotDeletedQuery() : QueryBuilder
- Get not deleted query
- isDeleted() : bool
- Return true if model is deleted
- restore() : bool
- Restore soft deleted models
- restoreAll() : bool
- Restore all soft deleted rows
- scopeGetDeleted() : Builder
- Get deleted scope
- scopeGetNotDeleted() : Builder
- Get not deleted scope
- softDelete() : bool
- Soft delete model
- softDeletedQuery() : QueryBuilder
- Get soft deleted query
Properties
$DEFAULT_SOFT_DELETE_COLUMN
Default soft delete column mame
protected
static string
$DEFAULT_SOFT_DELETE_COLUMN
= 'date_deleted'
Methods
clearDeleted()
Permanently delete all soft deleted models
public
clearDeleted() : bool
Return values
boolgetDeletedCount()
Get delete models count.
public
getDeletedCount() : int
Return values
intgetNotDeletedQuery()
Get not deleted query
public
getNotDeletedQuery() : QueryBuilder
Return values
QueryBuilderisDeleted()
Return true if model is deleted
public
isDeleted() : bool
Return values
boolrestore()
Restore soft deleted models
public
restore([mixed $id = null ]) : bool
Parameters
- $id : mixed = null
Return values
boolrestoreAll()
Restore all soft deleted rows
public
restoreAll() : bool
Return values
boolscopeGetDeleted()
Get deleted scope
public
scopeGetDeleted(Builder $query) : Builder
Parameters
- $query : Builder
Return values
BuilderscopeGetNotDeleted()
Get not deleted scope
public
scopeGetNotDeleted(Builder $query) : Builder
Parameters
- $query : Builder
Return values
BuildersoftDelete()
Soft delete model
public
softDelete([mixed $id = null ]) : bool
Parameters
- $id : mixed = null
Return values
boolsoftDeletedQuery()
Get soft deleted query
public
softDeletedQuery() : QueryBuilder