SoftDelete
trait Winter\Storm\Database\Traits\SoftDelete
Properties
protected
$forceDeleting
:
bool
= false
Indicates if the model is currently force deleting.
Methods
public static bootSoftDelete () : void
Boot the soft deleting trait for a model.
public forceDelete () : void
Force a hard delete on a soft deleted model.
public getDeletedAtColumn () : string
Get the name of the "deleted at" column.
public getQualifiedDeletedAtColumn () : string
Get the fully qualified "deleted at" column.
public isSoftDelete () : bool
Helper method to check if the model is currently being hard or soft deleted, useful in events.
public static onlyTrashed () : Illuminate\Database\Eloquent\Builder | static
Get a new query builder that only includes soft deletes.
public restore () : bool | null
Restore a soft-deleted model instance.
public static restored (Closure | string $callback) : void
Register a restored model event with the dispatcher.
Property | Type | Description |
---|---|---|
$callback | Closure | string |
Closure | string
|
public static restoring (Closure | string $callback) : void
Register a restoring model event with the dispatcher.
Property | Type | Description |
---|---|---|
$callback | Closure | string |
Closure | string
|
public trashed () : bool
Determine if the model instance has been soft-deleted.
public static withTrashed () : Illuminate\Database\Eloquent\Builder | static
Get a new query builder that includes soft deletes.
protected performDeleteOnModel () : mixed
Perform the actual delete query on this model instance.
protected performRestoreOnRelations () : void
Locates relations with softDelete flag and cascades the restore event.
protected performSoftDeleteOnRelations () : void
Locates relations with softDelete flag and cascades the delete event.
protected runSoftDelete () : void
Perform the actual delete query on this model instance.
protected updatePivotDeletedAtColumn (string $relationName, array $options, string | null $value)
Update relation pivot table deleted_at column
Property | Type | Description |
---|---|---|
$relationName | string |
string
|
$options | array |
array
|
$value | string | null |
string | null
|
Used by
Class | Description |
---|---|
User
|
Administrator user model |