OrmDefinitions class
define orm settings @param tableName => the table name of model @param primaryKey => The primary key associated with the table. @param primaryKeyVal => The value of primaryKey
Constructors
Properties
-
attributes
↔ List<
Map< ?String, dynamic> > -
Indicates if the model should be timestamped.
$timestamps = false;
The storage format of the model's date columns.
dateFormat = 'U';
const CREATED_AT = 'creation_date';
const UPDATED_AT = 'last_update';
The connection name for the model.
connection = 'connection-name';
The model's default values for attributes.
getter/setter pair
-
data
↔ Map<
String, dynamic> -
getter/setter pair
-
fillable
↔ List<
String> ? -
The attributes that are mass assignable.
Example fillable =
'name'
; A mass-assignment vulnerability occurs when a user passes an unexpected HTTP parameter through a request, and that parameter changes a column in your database you did not expect. For example, a malicious user might send an is_admin parameter through an HTTP request, which is then passed into your model's create method, allowing the user to escalate themselves to an administrator. While $fillable serves as a "white list" of attributes that should be mass assignable Importantly, you should use either $fillable or $guarded - not both. In the example below, all attributesgetter/setter pair -
guarded
↔ List<
String> ? -
The attributes that aren't mass assignable.
you may also choose to use $guarded. The $guarded property should contain an array of
attributes that you do not want to be mass assignable. All other attributes not in
the array will be mass assignable. So, $guarded functions like a "black list".
Importantly, you should use either $fillable or $guarded - not both.
In the example below, all attributes
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- idIncrementing ↔ bool
-
Indicates if the IDs are auto-incrementing.
getter/setter pair
- keyType ↔ String
-
The "type" of the auto-incrementing ID.
getter/setter pair
- primaryKey ↔ String
-
The primary key associated with the table.
getter/setter pair
- primaryKeyVal ↔ dynamic
-
getter/setter pair
-
relations
↔ List<
OrmRelation> ? -
supports several different types of relationships
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tableName ↔ String
-
the data of model to insert or update on database
the table name of model
getter/setter pair
Methods
-
clone(
) → OrmDefinitions -
isRelations(
) → bool -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited