Field

Field

new Field()

Properties:
Name Type Description
fk boolean Determines if it is a foreign field
pk boolean Determines if it is a primary key field
name string The field name
type string The field type
faker string The faker value
index boolean Determines if it is a index field
params object The field options
hidden boolean Determines if it is a hidden field
unique boolean Determines if it is a unique field
fillable boolean Determines if it is a fillable field
nullable boolean Determines if it is a nullable field
defaultValue string | array | null The default value
entity Entity The entity related from this field
inputs Array.<Input> All inputs of this field
foreign Foreign The primary key
relatedForeigns Array.<Foreign> The related foreigns
basicParentRelationships Array.<BasicRelationship> All basic parent relationships
basicForeignRelationships Array.<BasicRelationship> All basic foreign relationships
typedMorphRelationships Array.<MorphRelationship> All morphRelationship relationships
identifiedMorphRelationships Array.<MorphRelationship> All identified morphRelationship relationships
manyToManyModelRelationships Array.<ManyToManyRelationship> All manyToManyModel relationships
manyToManylocalModelRelationships Array.<ManyToManyRelationship> All manyToManyLocalModel relationships

Methods

getBelongsToRelationship() → {array|undefined}

Returns the belongsTo relationship
Returns:
Type
array | undefined

getDefaultForTemplate() → {string}

Returns the field default value for template (as string)
Returns:
Type
string

getFakerForTemplate() → {string}

Returns the faker value for the input
Returns:
Type
string

getForeignType() → {string}

Returns the foreign type
Returns:
Type
string

getType() → {object}

Returns the field type
Returns:
Type
object

hasFaker() → {boolean}

Check if this field has a faker value
Returns:
Type
boolean

isBoolean() → {boolean}

Check if this field is boolean type
Returns:
Type
boolean

isDate() → {boolean}

Check if this field is date type
Returns:
Type
boolean

isDateTime() → {boolean}

Check if this field is dateTime type
Returns:
Type
boolean

isEnum() → {boolean}

Check if this field is boolean Valid types: (enum, set)
Returns:
Type
boolean

isForeignKey() → {boolean}

Check if it is valid (name and type is not null)
Returns:
Type
boolean

isIndex() → {boolean}

Check if it is index
Returns:
Type
boolean

isJson() → {boolean}

Check if it is JSON
Returns:
Type
boolean

isPrimaryKey() → {boolean}

Check if it is the primary key
Returns:
Type
boolean

isSpecialPrimaryKey() → {boolean}

Check if it is the primary key and it has an special type (eg: UUID)
Returns:
Type
boolean

isString() → {boolean}

Check if this field is string Valid types: (string, char)
Returns:
Type
boolean

isTextual() → {boolean}

Check if this field is text Valid types: (string, text, char, date, datetime, timestamp)
Returns:
Type
boolean

isUnique() → {boolean}

Check if it is unique
Returns:
Type
boolean

isUuid() → {boolean}

Check if it is UUID
Returns:
Type
boolean

isValid() → {boolean}

Check if this field is valid (name and type is not null)
Returns:
Type
boolean

needsCasting() → {boolean}

Check if this field is boolean, JSON or date
Returns:
Type
boolean

notValid() → {boolean}

Check if it is not valid (name or type is null)
Returns:
Type
boolean

references(entity) → {boolean}

Checks if it references the entity passed in the argument as a foreign key
Parameters:
Name Type Description
entity Entity
Returns:
Type
boolean