On this page
SoftDeletes
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. |
|
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(Closure|string $callback) Register a "softDeleted" model event callback with the dispatcher. |
|
static void | restoring(Closure|string $callback) Register a "restoring" model event callback with the dispatcher. |
|
static void | restored(Closure|string $callback) Register a "restored" model event callback with the dispatcher. |
|
static void | forceDeleting(Closure|string $callback) Register a "forceDeleting" model event callback with the dispatcher. |
|
static void | forceDeleted(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. |
|
static Builder | withTrashed(bool $withTrashed = true) No description |
|
static Builder | onlyTrashed() No description |
|
static Builder | withoutTrashed() No description |
Details
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.
protected mixed performDeleteOnModel()
Perform the actual delete query on this model instance.
protected 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(Closure|string $callback)
Register a "softDeleted" model event callback with the dispatcher.
static void restoring(Closure|string $callback)
Register a "restoring" model event callback with the dispatcher.
static void restored(Closure|string $callback)
Register a "restored" model event callback with the dispatcher.
static void forceDeleting(Closure|string $callback)
Register a "forceDeleting" model event callback with the dispatcher.
static void forceDeleted(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.
static Builder withTrashed(bool $withTrashed = true)
No description
static Builder onlyTrashed()
No description
static Builder withoutTrashed()
No description
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/10.x/Illuminate/Database/Eloquent/SoftDeletes.html