Repeater::make('locations')
->schema([
Placeholder::make('location')
->label('')
->content(fn (Get $get) => $get('postcode').' '.$get('city')),
])
->addAction(function ($action) {
return $action->form([
TextInput::make('postcode'),
TextInput::make('city'),
])
->action(function ($data, Set $set, Get $get) {
$currentState = $get('locations') ?? [];
$result = array_merge($currentState, [$data]);
$set('locations', $result);
});
})
Repeater::make('locations')
->schema([
Placeholder::make('location')
->label('')
->content(fn (Get $get) => $get('postcode').' '.$get('city')),
])
->addAction(function ($action) {
return $action->form([
TextInput::make('postcode'),
TextInput::make('city'),
])
->action(function ($data, Set $set, Get $get) {
$currentState = $get('locations') ?? [];
$result = array_merge($currentState, [$data]);
$set('locations', $result);
});
})