Writing fields
Fields are a multi-dimensional array in thefields property of the admin model. Each key is the name of a database column, and the value is the field configuration combined with Laravel validation rules.
The configuration has two forms: an array, or a string of parameters separated by |.
String notation
This notation is recommended for all fields.Array notation
Not recommended — models with dozens of fields become very long.
Method notation
Sometimes validation has to differ between creating a new record and editing an existing one. In that case$row holds the record being edited.
Combining the string notation with arrays is the recommended form whenever you need more complex rules through Laravel rule objects.
Field types
Text
A text field represented by a plain input.type:string is the default, so it does not have to be written explicitly.Long text
A text field represented by a textarea.type:longtext for longtext support in the database.
Rich-text editor
A CKEditor input for simple text formatting.type:longeditor for longtext support in the database.
Integer
Decimal
Checkbox
An active or inactive value.Password
A hidden value of the password type.Select
One value from a list:options parameter in the field configuration, where the items are separated by commas.
$options property of the admin model.
options() method, for dynamically generated values.
Radio
Several options presented as radio inputs.options parameter in all of its forms.
Relations
Loads values into a select or multiselect from existing records in any database table. The first value of the parameter is the table name, the second is the column whose data is listed to the user.canAdd allows inserting records into the related table directly from the field.

filterBy filters the options of the current list based on the value of another field.
File uploads
An input for uploading a file or an image with automatic cropping.Use the
multiple parameter to upload several files into one field.Date and time
multiple parameter to select several dates or times at once, and format:d.m.Y to change the format.
Field parameters
Every field supports additional configuration through global attributes, including the Laravel validation rules, which can be combined with any field.Form parameters
required
The label of the field.
name:Article namerequired
The type of the field.
type:stringA description rendered as small text below the field.
title:Enter the phone number as +421 xxx xxx xxxPlaced inside the field while it is empty.
placeholder:Enter the phone number as +421 xxx xxx xxxDisables the field in the form.
The default value of the field.
default:10For a nested model you can use a value from the parent record.default:$parent.name or default:table_name.nameRemoves the field from the form entirely — its value is not present in the submitted request.
The field stays in the form and in the submitted request, but is invisible to the user.
Hides the field only when creating a record.
Hides the field only when editing a record.
When the model contains only one file field, submitting the form with several files creates a separate record for each of them.
Makes the field translatable. The column type switches to JSON, holding the value for each language version.See mirrored content.
Allows inserting new records from a relation field.See adding related records.
The options of a select or radio field.
options:Apple,Banana,StrawberryAllows selecting several values. Supported by
select, file, date and time fields.Filters the options based on another field. Supported by
select, belongsTo and belongsToMany fields.filterBy:field_name,database_column_nameSee filtering records.Prefills the field from a column of the selected related record.
fillBy:field_name,database_column_nameSee prefilling values.Listing table parameters
Hides the value from the record listing.
Hides the field from both the listing and the form.
The character limit in the listing table.
limit:50The default ordering of records by this column.
orderBy:asc or orderBy:descRenders the column as a clickable phone link.
A different column title in the listing than the field label in the form.
column_name:My other column titleDatabase parameters
SQL attribute for unique records.
SQL attribute for indexing the column.
SQL attribute for positive numbers.
A form field with no database column behind it. Useful for helper fields or custom components that store nothing.
Scoped parameters
Applies the parameter only in the administration.
inAdmin:requiredApplies the parameter only on the frontend.
inFrontend:requiredApplies the parameter only in the console.
inConsole:requiredCustom fields
When you need your own field, CrudAdmin lets you build one that is reactive and customisable to your requirements. Creating a field takes two steps. First, create the Vue component with anartisan command.
resources/views/admin/components/fields/MyCustomField.vue. The default component contains a working field template you can customise.
Then assign the component to a field with the component parameter. The component is loaded from the global components directory automatically.
<template> element with the HTML, and a <script> element with the logic. CrudAdmin parses and renders both without a build step.
resources/views/admin/components/fields/MyCustomField.vue
Vue components do not need to be compiled. CrudAdmin loads and renders them automatically.
Grouping fields
Fields can be arranged into groups, which makes complex forms with many fields easier to read. A group is created by passing fields to one of the methods of theAdmin\Fields\Group class, available in every admin model.
A group can be named in two ways — through the array key, or through the
name() method.A group can also have an icon, set with
icon('fa-truck'). See the Font Awesome 4 icon list.Full width group
This example shows both ways of naming a group.
Half width group

Third width group

Custom width group
The width can also be set dynamically withwidth(), building your own grid divided into 12 parts.

Inline group
inline() aligns every field in the group into a single row.

Nested groups
Groups can be nested to any depth, which lets you build complex forms.
Arranging fields into tabs
Fields can also be arranged into tabs.Tabs are named the same way as groups, and can carry an icon set with
icon('fa-truck').Tabs combined with groups

A tab from an admin model
A tab can also hold a complete admin model module.