Numeric: int, float, order
These types are divided into:
- int - integer
- float - real
- order - integer position number
Purpose: working with numeric data, the order type is used to change the serial number of a record in the general list and when displayed in the administrative part has its own appearance with arrows that allow you to change its location in the list.
Field type in the SQL table: int and float, respectively.
Additional parameters:
positive
Purpose: allows only positive values for this field
Possible values: true, false
Default: false
zero_allowed
Purpose: allows zero values for this field
Possible values: true, false
Default: true
decimal
Purpose: for the float type, sets the possible size of the number and the number of digits after the decimal point. Important for storing precise data (e.g., financial) in MySQL tables.
Possible values: a string like '10,2' where 10 is the maximum number of digits in the number, and 2 is the number of digits after the decimal point.
Default: null
Position in list: order
To manage the sequence number of an element in the general list, there is a special data type order. Initially, this is an integer field for entering values of the following type: 1, 2, 5, 14. For a field with the order type in the general table of records, arrows appear in the administrative panel for moving the element relative to others in the list. Also, when creating a new record in the admin panel, the next serial number in the list is substituted into this field.
SQL selection from the table is often ordered by this field (ORDER BY `field`). It is used for pages, products, articles and many other modules where there is ordering of records when displayed on the site.
Field type in the SQL table: int
depend_on_enum
Purpose: blocks the ability to move records when clicking on the arrows in the model table in the admin panel. The blocking is removed when a filter is launched on the specified field. Blocking is needed in cases where it is logical to change the sequence numbers only when setting the required filter.
Possible values: name of enum-type fields in the current model, for example supplier, brand
Default: false
Examples:
['Price', 'int', 'price']
['Weight', 'float', 'weight', ['required' => true]]
['Total cost', 'float', 'total_cost', ['decimal' => '8,2']]
['Quantity', 'int', 'number', ['zero_allowed' => false, 'positive' => true]]
['Position', 'order', 'order']
Previous section
String char