Typing

This is the official documentation of the forestadmin/laravel-forestadmin v2+ and forestadmin/symfony-forestadmin PHP agents.

Fields on Forest Admin can either use Primitive Types or Composite Types.

Primitive types

The primitive types which are supported by Forest Admin are the following:

Composite types

  • Fields using composite types are not sortable and do not implement validation.

  • Fields that are an array of a primitive type only are filterable (depending on the data source).

// Object containing 2 strings
const typeOfObjectWithTwoStrings = { firstName: 'String', lastName: 'String' };

// Array of strings
const typeOfArrayOfStrings = ['String'];

// Array of objects
const typeOfArrayOfObjects = [{ content: 'String' }];

// Object containing a 2d-grid of numbers
const typeOfObjectContainingAGridOfNumbers = { content: [['Number']] };

When using composite types, the data in the UI may not be displayed as you expect!

If you want to force displaying your data as a new Collection in the Related Data section, but can't because your data model contains nested objects, you may consider typing all nested objects as 'JSON'.

Last updated