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
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]]
['Quantity', 'int', 'number', ['zero_allowed' => false, 'positive' => true]]
['Position', 'order', 'order']
Previous section
String char