public static function form(Form $form): Form
{
return $form
->schema([
// [...]
Repeater::make('item')
->collapsible()
->relationship('items')
->schema([
TextInput::make('name')->required()->maxLength(255),
Toggle::make('done')->inline(false)->default(false),
RichEditor::make('description')->required(),
])
->itemLabel(fn (array $state): ?string => $state['name'] ?? null)
->collapsed(fn (array $state): bool => $state['done']), // THIS WON'T WORK. (I don't know how to access $state in collapsed)
]);
// [...]
}
public static function form(Form $form): Form
{
return $form
->schema([
// [...]
Repeater::make('item')
->collapsible()
->relationship('items')
->schema([
TextInput::make('name')->required()->maxLength(255),
Toggle::make('done')->inline(false)->default(false),
RichEditor::make('description')->required(),
])
->itemLabel(fn (array $state): ?string => $state['name'] ?? null)
->collapsed(fn (array $state): bool => $state['done']), // THIS WON'T WORK. (I don't know how to access $state in collapsed)
]);
// [...]
}