October\Rain\Database\Traits\SoftDelete

Source: ~/vendor/october/rain/src/Database/Traits/SoftDelete.php

Protected properties

protected bool $forceDeleting

Indicates if the model is currently force deleting.

Public methods

public static void bootSoftDelete()

Boot the soft deleting trait for a model.

public void forceDelete()

Force a hard delete on a soft deleted model.

public string getDeletedAtColumn()

Get the name of the "deleted at" column.

public string getQualifiedDeletedAtColumn()

Get the fully qualified "deleted at" column.

public bool isSoftDelete()

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

public static Illuminate\Database\Eloquent\Builder|static onlyTrashed()

Get a new query builder that only includes soft deletes.

public bool|null restore()

Restore a soft-deleted model instance.

public static void restored(Closure|string $callback)

Register a restored model event with the dispatcher.

Parameters
  • Closure|string $callback

public static void restoring(Closure|string $callback)

Register a restoring model event with the dispatcher.

Parameters
  • Closure|string $callback

public bool trashed()

Determine if the model instance has been soft-deleted.

public static Illuminate\Database\Eloquent\Builder|static withTrashed()

Get a new query builder that includes soft deletes.

Protected methods

protected mixed performDeleteOnModel()

Perform the actual delete query on this model instance.

protected void performRestoreOnRelations()

Locates relations with softDelete flag and cascades the restore event.

protected void performSoftDeleteOnRelations()

Locates relations with softDelete flag and cascades the delete event.

protected void runSoftDelete()

Perform the actual delete query on this model instance.