SoftDeletes<T> mixin

Superclass constraints

Properties

appends Map<String, dynamic>
The accessors to append to the model's array form.
no setterinherited
attributes Map<String, dynamic>
Get all of the current attributes on the model.
no setterinherited
casts Map<String, dynamic>
The attributes that should be cast to native types.
no setterinherited
deletedAt DateTime?
Get the deleted_at value
getter/setter pair
deletedAtColumn String
The name of the "deleted at" column
no setter
dispatchesEvents Map<ModelLifecycle, Event Function(T)>
The event map for the model.
no setterinherited
exists bool
getter/setter pairinherited
fillable List<String>
The attributes that are mass assignable.
no setterinherited
guarded List<String>
The attributes that aren't mass assignable.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
hidden List<String>
The attributes that should be hidden for serialization.
no setterinherited
id int?
getter/setter pairinherited
isNotTrashed bool
Check if the model is NOT soft deleted
no setter
isTrashed bool
Check if the model is currently soft deleted
no setter
original Map<String, dynamic>
Get the original attributes.
no setterinherited
primaryKey String
no setterinherited
query QueryBuilderInterface<T>
Get a new query builder for the model's table.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
table String
no setterinherited
tableName String
no setterinherited
trashed bool
Determine if the model instance has been soft-deleted
no setter
visible List<String>
The attributes that should be visible in serialization.
no setterinherited

Methods

all() Future<List<T>>
Get all models.
inherited
append(List<String> attributes) → void
Append attributes.
inherited
castAttribute(String key, dynamic value) → dynamic
Cast an attribute to its declared Dart type.
inherited
decrement(String column, [int amount = 1]) Future<void>
Decrement a column's value.
inherited
delete() Future<bool>
Override default delete to use soft delete
override
except(List<String> keys) Map<String, dynamic>
Get all attributes except the given keys.
inherited
fill(Map<String, dynamic> attributes) → T
Fill the model with an array of attributes.
inherited
find(dynamic id) Future<T?>
Find a model by its primary key.
inherited
findOrFail(dynamic id) Future<T>
Find a model by its primary key or throw an exception.
inherited
fireModelEvent(ModelLifecycle event, {bool halt = true}) Future<bool>
Fire a model lifecycle event.
inherited
forceDelete() Future<bool>
Permanently delete the model from the database
forceFill(Map<String, dynamic> attributes) → T
Force fill the model with an array of attributes.
inherited
fresh([List<String> withRelations = const []]) Future<T?>
Get a fresh instance of the model from the database.
inherited
fromJson(Map<String, dynamic> json) → void
Initialize from database record
inherited
getAttribute(String key) → dynamic
Get an attribute from the model.
inherited
getDirty() Map<String, dynamic>
Get the attributes that have been changed since the last sync.
inherited
getKey() → dynamic
inherited
getOriginal(String key, [dynamic defaultValue]) → dynamic
Get an original attribute value.
inherited
getRawAttribute(String key, [dynamic defaultValue]) → dynamic
Get a raw attribute without casting.
inherited
hasAttribute(String key) bool
Check if the model has a specific attribute.
inherited
hasCast(String key) bool
Determine if an attribute has a cast.
inherited
hasOriginal(String key) bool
Check if the model has a specific original attribute.
inherited
increment(String column, [int amount = 1]) Future<void>
Increment a column's value.
inherited
isClean([dynamic attributes]) bool
Check if the model or specific attribute is clean.
inherited
isDirty([dynamic attributes]) bool
Check if the model or specific attribute is dirty.
inherited
isFillable(String key) bool
Determine if the given attribute may be mass assigned.
inherited
makeHidden(List<String> attributes) → void
Make attributes hidden.
inherited
makeVisible(List<String> attributes) → void
Make attributes visible.
inherited
mergeAttributes(Map<String, dynamic> attributes) → void
Merge new attributes into the model.
inherited
newFactory(Map<String, dynamic> data) → T
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
only(List<String> keys) Map<String, dynamic>
Get a subset of attributes.
inherited
refresh() Future<void>
Refresh the model from the database.
inherited
restore({bool touch = true}) Future<bool>
Restore a soft-deleted model
save() Future<bool>
Save the model to the database.
inherited
setAttribute(String key, dynamic value) → void
Set a given attribute on the model.
inherited
setRawAttribute(String key, dynamic value) → void
Set a raw attribute without casting.
inherited
softDelete({DateTime? at}) Future<bool>
Soft delete the model (set deleted_at timestamp)
syncOriginal() → void
Sync the original attributes with the current.
inherited
toDatabaseMap() Map<String, dynamic>
Prepare the model for database insertion/update.
inherited
toJson() Map<String, dynamic>
Convert the model instance to JSON.
inherited
toJsonAsync() Future<Map<String, dynamic>>
inherited
toMap() Map<String, dynamic>
Convert the model instance to a map.
inherited
toMapAsync() Future<Map<String, dynamic>>
Convert the model instance to a map, resolving any Future values.
inherited
toString() String
A string representation of this object.
inherited
update(Map<String, dynamic> attributes) Future<bool>
Update the model in the database.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited