trait SoftDeletes (View source)

Properties

protected bool $forceDeleting

Indicates if the model is currently force deleting.

Methods

static void
bootSoftDeletes()

Boot the soft deleting trait for a model.

void
initializeSoftDeletes()

Initialize the soft deleting trait for an instance.

bool|null
forceDelete()

Force a hard delete on a soft deleted model.

bool|null
forceDeleteQuietly()

Force a hard delete on a soft deleted model without raising any events.

static int
forceDestroy(Collection|array|int|string $ids)

Destroy the models for the given IDs.

mixed
performDeleteOnModel()

Perform the actual delete query on this model instance.

void
runSoftDelete()

Perform the actual delete query on this model instance.

bool
restore()

Restore a soft-deleted model instance.

bool
restoreQuietly()

Restore a soft-deleted model instance without raising any events.

bool
trashed()

Determine if the model instance has been soft-deleted.

static void
softDeleted(QueuedClosure|Closure|string $callback)

Register a "softDeleted" model event callback with the dispatcher.

static void
restoring(QueuedClosure|Closure|string $callback)

Register a "restoring" model event callback with the dispatcher.

static void
restored(QueuedClosure|Closure|string $callback)

Register a "restored" model event callback with the dispatcher.

static void
forceDeleting(QueuedClosure|Closure|string $callback)

Register a "forceDeleting" model event callback with the dispatcher.

static void
forceDeleted(QueuedClosure|Closure|string $callback)

Register a "forceDeleted" model event callback with the dispatcher.

bool
isForceDeleting()

Determine if the model is currently force deleting.

string
getDeletedAtColumn()

Get the name of the "deleted at" column.

string
getQualifiedDeletedAtColumn()

Get the fully qualified "deleted at" column.

Details

static void bootSoftDeletes()

Boot the soft deleting trait for a model.

Return Value

void

void initializeSoftDeletes()

Initialize the soft deleting trait for an instance.

Return Value

void

bool|null forceDelete()

Force a hard delete on a soft deleted model.

Return Value

bool|null

bool|null forceDeleteQuietly()

Force a hard delete on a soft deleted model without raising any events.

Return Value

bool|null

static int forceDestroy(Collection|array|int|string $ids)

Destroy the models for the given IDs.

Parameters

Collection|array|int|string $ids

Return Value

int

protected mixed performDeleteOnModel()

Perform the actual delete query on this model instance.

Return Value

mixed

protected void runSoftDelete()

Perform the actual delete query on this model instance.

Return Value

void

bool restore()

Restore a soft-deleted model instance.

Return Value

bool

bool restoreQuietly()

Restore a soft-deleted model instance without raising any events.

Return Value

bool

bool trashed()

Determine if the model instance has been soft-deleted.

Return Value

bool

static void softDeleted(QueuedClosure|Closure|string $callback)

Register a "softDeleted" model event callback with the dispatcher.

Parameters

QueuedClosure|Closure|string $callback

Return Value

void

static void restoring(QueuedClosure|Closure|string $callback)

Register a "restoring" model event callback with the dispatcher.

Parameters

QueuedClosure|Closure|string $callback

Return Value

void

static void restored(QueuedClosure|Closure|string $callback)

Register a "restored" model event callback with the dispatcher.

Parameters

QueuedClosure|Closure|string $callback

Return Value

void

static void forceDeleting(QueuedClosure|Closure|string $callback)

Register a "forceDeleting" model event callback with the dispatcher.

Parameters

QueuedClosure|Closure|string $callback

Return Value

void

static void forceDeleted(QueuedClosure|Closure|string $callback)

Register a "forceDeleted" model event callback with the dispatcher.

Parameters

QueuedClosure|Closure|string $callback

Return Value

void

bool isForceDeleting()

Determine if the model is currently force deleting.

Return Value

bool

string getDeletedAtColumn()

Get the name of the "deleted at" column.

Return Value

string

string getQualifiedDeletedAtColumn()

Get the fully qualified "deleted at" column.

Return Value

string