SoftDelete

 trait Winter\Storm\Database\Traits\SoftDelete

Properties

protected $forceDeleting : bool

Indicates if the model is currently force deleting.

Methods

public static bootSoftDelete () : void

Boot the soft deleting trait for a model.

Returns
void

public forceDelete () : void

Force a hard delete on a soft deleted model.

Returns
void

public getDeletedAtColumn () : string

Get the name of the "deleted at" column.

Returns
string

public getQualifiedDeletedAtColumn () : string

Get the fully qualified "deleted at" column.

Returns
string

public isSoftDelete () : bool

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

Returns
bool

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

Get a new query builder that only includes soft deletes.

Returns
Illuminate\Database\Eloquent\Builder | static

public restore () : bool | null

Restore a soft-deleted model instance.

Returns
bool | null

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

Register a restored model event with the dispatcher.

Parameters
Property Description
$callback
Closure | string
Returns
void

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

Register a restoring model event with the dispatcher.

Parameters
Property Description
$callback
Closure | string
Returns
void

public trashed () : bool

Determine if the model instance has been soft-deleted.

Returns
bool

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

Get a new query builder that includes soft deletes.

Returns
Illuminate\Database\Eloquent\Builder | static

protected performDeleteOnModel () : mixed

Perform the actual delete query on this model instance.

Returns
mixed

protected performRestoreOnRelations () : void

Locates relations with softDelete flag and cascades the restore event.

Returns
void

protected performSoftDeleteOnRelations () : void

Locates relations with softDelete flag and cascades the delete event.

Returns
void

protected runSoftDelete () : void

Perform the actual delete query on this model instance.

Returns
void

protected updatePivotDeletedAtColumn (string $relationName, array $options, string | null $value)

Update relation pivot table deleted_at column

Parameters
Property Description
$relationName
string
$options
array
$value
string | null
Returns
mixed

Used by

Class Description
User

Administrator user model

Copyright © 2024 Winter CMS