Primitive types
bool
The bool type provides a simple true/false/null boolean.
| Attribute | Type | Description |
|---|---|---|
| default | string | The default value for the field. Truthy values are interpreted as true, falsy values as false. |
| deferred | boolean | When present, the field will be stored in a separate table to improve performance for common use. Deferred fields will be fetched using a secondary query as soon as one is accessed. |
| index | boolean | When present, the database field will be indexed. |
| name | string|required | Name of the field. |
| required | boolean | When present, the field will not be nullable. |
date
The date type provides a DATE field. Saturn will handle values as DateTime objects where the time always equals 00:00.
| Attribute | Type | Description |
|---|---|---|
| deferred | boolean | When present, the field will be stored in a separate table to improve performance for common use. Deferred fields will be fetched using a secondary query as soon as one is accessed. |
| index | boolean | When present, the database field will be indexed. |
| name | string|required | Name of the field. |
| required | boolean | When present, the field will not be nullable. |
datetime
The datetime type provides a DATETIME field.
| Attribute | Type | Description |
|---|---|---|
| deferred | boolean | When present, the field will be stored in a separate table to improve performance for common use. Deferred fields will be fetched using a secondary query as soon as one is accessed. |
| index | boolean | When present, the database field will be indexed. |
| name | string|required | Name of the field. |
| required | boolean | When present, the field will not be nullable. |
decimal
The decimal type provides a DECIMAL field.
| Attribute | Type | Description |
|---|---|---|
| default | string | The default value for the field. |
| deferred | boolean | When present, the field will be stored in a separate table to improve performance for common use. Deferred fields will be fetched using a secondary query as soon as one is accessed. |
| index | boolean | When present, the database field will be indexed. |
| name | string|required | Name of the field. |
| required | boolean | When present, the field will not be nullable. |
domain
The domain type provides a VARCHAR field, specifically intended for domain names.
| Attribute | Type | Description |
|---|---|---|
| name | string|required | Name of the field. |
| required | boolean | When present, the field will not be nullable. |
The email type provides a VARCHAR field, specifically intended for email addresses.
| Attribute | Type | Description |
|---|---|---|
| index | boolean | When present, the database field will be indexed. |
| multilingual | boolean | When present, multiple database fields will be used to support internationalisation. |
| name | string|required | Name of the field. |
| required | boolean | When present, the field will not be nullable. |
int
The int type provides an integer field. Saturn will create an unsigned TINYINT, SMALLINT, MEDIUMINT, INT or BIGINT field based on the value of the max attribute.
| Attribute | Type | Description |
|---|---|---|
| default | string | The default value for the field. |
| deferred | boolean | When present, the field will be stored in a separate table to improve performance for common use. Deferred fields will be fetched using a secondary query as soon as one is accessed. |
| index | boolean | When present, the database field will be indexed. |
| max | integer | Maximum value of the field. Also used to determine storage size in the database. Defaults to 4294967295 (INTEGER field). |
| multilingual | boolean | When present, multiple database fields will be used to support internationalisation. |
| name | string|required | Name of the field. |
| required | boolean | When present, the field will not be nullable. |
json
The json type provides a TEXT field, specifically intended for JSON formatted strings.
| Attribute | Type | Description |
|---|---|---|
| deferred | boolean | When present, the field will be stored in a separate table to improve performance for common use. Deferred fields will be fetched using a secondary query as soon as one is accessed. |
| name | string|required | Name of the field. |
| required | boolean | When present, the field will not be nullable. |
language
The language type provides a field for language selection. The value will be stored as a language identifier in a field of type VARCHAR(2), and retrieved as an object of type Core\Language.
| Attribute | Type | Description |
|---|---|---|
| name | string|required | Name of the field. |
password
The password type provides a field for a password hash. It also makes the corresponding entity authenticatable.
| Attribute | Type | Description |
|---|---|---|
| name | string|required | Name of the field. |
| required | boolean | When present, the field will not be nullable. |
Use a field of password type as follows:
// check password validity
if ($entity->pass->matches($password)) echo "Password correct";
// change a password
$entity->pass = "correct horse battery staple";
$entity->save();
phone
The phone type provides a VARCHAR field, specifically intended for phone numbers.
| Attribute | Type | Description |
|---|---|---|
| deferred | boolean | When present, the field will be stored in a separate table to improve performance for common use. Deferred fields will be fetched using a secondary query as soon as one is accessed. |
| index | boolean | When present, the database field will be indexed. |
| multilingual | boolean | When present, multiple database fields will be used to support internationalisation. |
| name | string|required | Name of the field. |
| required | boolean | When present, the field will not be nullable. |
slug
The slug type provides a VARCHAR field, specifically intended for URL formatted strings. Use the source or format attributes to automatically populate it with a URL formatted value based on other fields. Supports internationalisation by default.
| Attribute | Type | Description |
|---|---|---|
| format | string | String containing placeholders of fieldnames for more advanced formatting. |
| name | string|required | Name of the field. |
| source | string | Name of a string or text field by which to determine the slug value. |
| unilingual | boolean | When present, only a single database field will be created and support for internationalisation will be disabled. |
string
The string type provides a VARCHAR field. Supports internationalisation by default.
| Attribute | Type | Description |
|---|---|---|
| deferred | boolean | When present, the field will be stored in a separate table to improve performance for common use. Deferred fields will be fetched using a secondary query as soon as one is accessed. |
| index | boolean | When present, the database field will be indexed. |
| length | integer | Maximum length of the string value. Also used to determine database storage size. |
| name | string|required | Name of the field. |
| required | boolean | When present, the field will not be nullable. |
| unilingual | boolean | When present, only a single database field will be created and support for internationalisation will be disabled. |
text
The text type provides a TINYTEXT, TEXT, MEDIUMTEXT or LONGTEXT field (based on the length attribute). Supports internationalisation by default.
| Attribute | Type | Description |
|---|---|---|
| deferred | boolean | When present, the field will be stored in a separate table to improve performance for common use. Deferred fields will be fetched using a secondary query as soon as one is accessed. |
| length | integer | Maximum string length of the value. Also used to determine database storage size. |
| name | string|required | Name of the field. |
| required | boolean | When present, the field will not be nullable. |
| unilingual | boolean | When present, only a single database field will be created and support for internationalisation will be disabled. |
time
The time type provides a TIME field. Saturn will handle values as DateTime objects.
| Attribute | Type | Description |
|---|---|---|
| deferred | boolean | When present, the field will be stored in a separate table to improve performance for common use. Deferred fields will be fetched using a secondary query as soon as one is accessed. |
| index | boolean | When present, the database field will be indexed. |
| name | string|required | Name of the field. |
| required | boolean | When present, the field will not be nullable. |
url
The url type provides a VARCHAR field, specifically intended for URLs. Supports internationalisation by default.
| Attribute | Type | Description |
|---|---|---|
| deferred | boolean | When present, the field will be stored in a separate table to improve performance for common use. Deferred fields will be fetched using a secondary query as soon as one is accessed. |
| index | boolean | When present, the database field will be indexed. |
| internal | boolean | When present, the field will only accept internal links (through the CMS). |
| length | integer | Maximum string length of the value. Also used to determine database storage size. |
| name | string|required | Name of the field. |
| required | boolean | When present, the field will not be nullable. |
| unilingual | boolean | When present, only a single database field will be created and support for internationalisation will be disabled. |