List Field

Column Type none

Displays a list of links or strings. This is purely for the purposes of displaying data such as relationships on the edit page - the data here cannot be updated.

To use, set a getter function. This will be passed the model that is being edited and should return an array of items to list.

Links

To display a list of links, the items in the array should include a url and name parameter.

(new ListField('things'))
    ->setDataGetter(function ($item) {
        return $item->things->map(function ($thing) {
            return [
                'name' => $thing->title,
                'url' => route('admin.users.edit', $thing->getKey()),
            ];
        });
    }),

Plain Text

To display a plain text list, just provide an id attribute.

(new ListField('things'))
    ->setDataGetter(function ($item) {
        return $item->things->map(function ($thing) {
            return [
                'id' => $thing->getKey(),
            ];
        });
    }),