SoftDeletingTrait

trait SoftDeletingTrait (View source)

Properties

protected bool $forceDeleting Indicates if the model is currently force deleting.

Methods

static void bootSoftDeletingTrait()

Boot the soft deleting trait for a model.

void forceDelete()

Force a hard delete on a soft deleted model.

void performDeleteOnModel()

Perform the actual delete query on this model instance.

void runSoftDelete()

Perform the actual delete query on this model instance.

bool|null restore()

Restore a soft-deleted model instance.

bool trashed()

Determine if the model instance has been soft-deleted.

static Builder|SoftDeletingTrait withTrashed()

Get a new query builder that includes soft deletes.

static Builder|SoftDeletingTrait onlyTrashed()

Get a new query builder that only includes soft deletes.

static void restoring(Closure|string $callback)

Register a restoring model event with the dispatcher.

static void restored(Closure|string $callback)

Register a restored model event with the dispatcher.

string getDeletedAtColumn()

Get the name of the "deleted at" column.

string getQualifiedDeletedAtColumn()

Get the fully qualified "deleted at" column.

Details

static void bootSoftDeletingTrait()

Boot the soft deleting trait for a model.

Return Value

void

void forceDelete()

Force a hard delete on a soft deleted model.

Return Value

void

protected void performDeleteOnModel()

Perform the actual delete query on this model instance.

Return Value

void

protected void runSoftDelete()

Perform the actual delete query on this model instance.

Return Value

void

bool|null restore()

Restore a soft-deleted model instance.

Return Value

bool|null

bool trashed()

Determine if the model instance has been soft-deleted.

Return Value

bool

static Builder|SoftDeletingTrait withTrashed()

Get a new query builder that includes soft deletes.

Return Value

Builder|SoftDeletingTrait

static Builder|SoftDeletingTrait onlyTrashed()

Get a new query builder that only includes soft deletes.

Return Value

Builder|SoftDeletingTrait

static void restoring(Closure|string $callback)

Register a restoring model event with the dispatcher.

Parameters

Closure|string $callback

Return Value

void

static void restored(Closure|string $callback)

Register a restored model event with the dispatcher.

Parameters

Closure|string $callback

Return Value

void

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

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/4.2/Illuminate/Database/Eloquent/SoftDeletingTrait.html