Where parameters are documented
Fields
Fields are returned from thefields() method. The method receives the edited record, so rules can depend on it.
app/Models/Customer.php
$row is null when a record is created, and the edited record when it is updated in the administration, in getValidationRules($row) and in validateRequest() called on a record. Fields resolved for a record do not change the fields returned later without a record.
The complete field reference is in Fields.
Basic parameters
Module name
The name of the module in the sidebar, in the module header and in the change history.app/Models/Article.php
name() method instead.

Module description
Optional description shown under the module name. Literal messages are translated through gettext.
Module icon
Font Awesome icon of the module in the sidebar, theicon setting. The menu editor of crudadmin/admin-editor changes it by a click on the icon and writes it into the models section of bootstrap/admin.php.
bootstrap/admin.php
bootstrap/admin.php overrides it like any other setting. An icon which depends on runtime conditions is returned by settings().
Without an icon, well known table names get one automatically, e.g. a table ending with
articles gets fa-file-alt, orders gets fa-credit-card. The name is matched by the singular of the last segment of the table name, so articles_categories is matched as category.Disabling the module
Set$active to false to hide the module from the menu. The table is still migrated, and the module offers no permissions in user groups.
Dynamic parameters
Callable parameters can be declared as methods. The method wins over the property and is evaluated when the value is needed.set{Property}Property() mutator changes the resolved value. It can be declared on the model, in a parent class or in a model module. Model mutators run first, module mutators receive their result.
name, group, fields, active, inMenu, single, options, searches, insertable, editable, publishable, deletable, rules, settings, buttons, exports, reserved, layouts and belongsToModel.
Cached queries
Cache small, rarely changed tables (countries, VAT rates, settings) and flush them automatically when a record is saved, deleted or reordered in the administration.app/Models/Country.php
models.{table}.{key}. Mass updates through the query builder (Country::query()->update([...])) do not flush the cache.
Replicating records
replicateWithRelations() creates a copy of the record including many to many relations and all records of child models. It is typically used in a button.
app/Admin/Buttons/ReplicateCourse.php
Single files are copied with the
cloned_xxxx_ prefix, multiple file fields keep references to the same files.
replicate() of admin models skips the _order column, so the copy gets a new position.
Site tree
Available with the
crudadmin/website package (composer require crudadmin/website).app/Models/Branch.php