Tree structured models
Tree structuring covers the many to one relation, where one record holds further sub-records. Editing the parent record shows a nested module for the records attached to it.

$belongsToModel parameter defines the parent admin model. The child model is shown as a tab in the parent form and is not listed in the menu.
app/Models/OrdersItem.php
order_id column with a foreign key is created. The column name is the snake case parent class name with _id, also when the parent uses a custom $table.
If a model is a child of several admin models, pass an array. Every parent gets its own nullable column.
php artisan admin:migrate asks for a parent id for the existing rows. Fill them in code instead with a hook named by the column.
Recursive trees
A model related to itself builds a tree of unlimited depth, e.g. categories. Rows can be dragged between levels.$withRecursiveRows to load all rows at once.
onRecursiveDragAndDrop() is called for a row moved under another parent (null for the root level).
Children created before the parent
$withoutParent allows adding child rows in the form of a new, unsaved parent. They are attached when the parent is saved.
$nullableRelation only makes the foreign column nullable, e.g. for rows imported without a parent. The form is not changed.
Child form inside the parent form
A single child model can be merged into the parent form. Both records are validated and saved in one request, a missing child record is created when the parent is updated.Relation to any model
$globalRelation makes a model attachable under any parent without a foreign key, e.g. notes or attachments. The parent is stored in the _table and _row_id columns, which are hidden when the model is serialized on the website.
Reordering records
Rows of every admin model can be reordered by drag and drop. The position is stored in an indexed_order column and rows are ordered by _order DESC, so a new row appears on top. Set the property to false to disable reordering.
Reordering is also disabled when
$orderBy uses another column than _order, and in single record mode. No _order column is created then, and reorder requests are refused.php artisan admin:migrate.
React to a finished reorder with onUpdateOrder(), e.g. to flush a cached menu. A returned value is sent as the response.
Publishing records
Publishing is enabled on every admin model by default. The table gets an indexedpublished_at column, and each row gets a publish / hide button. Set the property, or a publishable() method, to false to turn publishing off.
published_at in the past, so a row can be scheduled by saving a future date.
The administration always lists all rows. Publishing more selected rows toggles every row by its own state.
Single record mode
$single sets $minimum and $maximum to 1. The table is hidden and the page contains only the form of one record.
Single models are not sortable, so no
_order column is created. Publishing is not changed. A single child model is related to its parent as hasOne, e.g. $order->invoice.Menu
Module group
An admin model can be assigned to a menu group defined in the configuration. Use dot notation for nested groups.
group() method.
Menu visibility
Root models are listed in the menu, child models only inside their parent.$inMenu overrides it.
Initially hidden tabs and groups
Tabs and field groups with anid can be hidden when the form opens, and shown later from a custom component.