Documentation

SoftDelete

Table of Contents

$forceDeleting  : bool
Indicates if the model is currently force deleting.
bootSoftDelete()  : void
Boot the soft deleting trait for a model.
forceDelete()  : void
Force a hard delete on a soft deleted model.
getDeletedAtColumn()  : string
Get the name of the "deleted at" column.
getQualifiedDeletedAtColumn()  : string
Get the fully qualified "deleted at" column.
isSoftDelete()  : bool
Helper method to check if the model is currently being hard or soft deleted, useful in events.
onlyTrashed()  : Builder|static
Get a new query builder that only includes soft deletes.
restore()  : bool|null
Restore a soft-deleted model instance.
restored()  : void
Register a restored model event with the dispatcher.
restoring()  : void
Register a restoring model event with the dispatcher.
trashed()  : bool
Determine if the model instance has been soft-deleted.
withTrashed()  : Builder|static
Get a new query builder that includes soft deletes.
performDeleteOnModel()  : mixed
Perform the actual delete query on this model instance.
performRestoreOnRelations()  : void
Locates relations with softDelete flag and cascades the restore event.
performSoftDeleteOnRelations()  : void
Locates relations with softDelete flag and cascades the delete event.
runSoftDelete()  : void
Perform the actual delete query on this model instance.

Properties

$forceDeleting

Indicates if the model is currently force deleting.

protected bool $forceDeleting = false

Methods

bootSoftDelete()

Boot the soft deleting trait for a model.

public static bootSoftDelete() : void
Return values
void

forceDelete()

Force a hard delete on a soft deleted model.

public forceDelete() : void
Return values
void

getDeletedAtColumn()

Get the name of the "deleted at" column.

public getDeletedAtColumn() : string
Return values
string

getQualifiedDeletedAtColumn()

Get the fully qualified "deleted at" column.

public getQualifiedDeletedAtColumn() : string
Return values
string

isSoftDelete()

Helper method to check if the model is currently being hard or soft deleted, useful in events.

public isSoftDelete() : bool
Return values
bool

onlyTrashed()

Get a new query builder that only includes soft deletes.

public static onlyTrashed() : Builder|static
Return values
Builder|static

restore()

Restore a soft-deleted model instance.

public restore() : bool|null
Return values
bool|null

restored()

Register a restored model event with the dispatcher.

public static restored(Closure|string $callback) : void
Parameters
$callback : Closure|string
Return values
void

restoring()

Register a restoring model event with the dispatcher.

public static restoring(Closure|string $callback) : void
Parameters
$callback : Closure|string
Return values
void

trashed()

Determine if the model instance has been soft-deleted.

public trashed() : bool
Return values
bool

withTrashed()

Get a new query builder that includes soft deletes.

public static withTrashed() : Builder|static
Return values
Builder|static

performDeleteOnModel()

Perform the actual delete query on this model instance.

protected performDeleteOnModel() : mixed
Return values
mixed

performRestoreOnRelations()

Locates relations with softDelete flag and cascades the restore event.

protected performRestoreOnRelations() : void
Return values
void

performSoftDeleteOnRelations()

Locates relations with softDelete flag and cascades the delete event.

protected performSoftDeleteOnRelations() : void
Return values
void

runSoftDelete()

Perform the actual delete query on this model instance.

protected runSoftDelete() : void
Return values
void

Search results