Populate a date in a repeater item from its preceding sibling?

I want to set a default value for the date field in each new repeater item, so it is matches the date of the previous item. I've tried using the
default()
default()
method on the field, with a
$get
$get
closure, but I can seem to get any data out of the
$get
$get
call. Is this the wrong approach?
->schema([
DatePicker::make('date')
->label(__('Date'))
->lazy()
->default(fn (Closure $get) => $get('../../date')
->required(),
TimePicker::make('start_time')
->label(__('Start Time'))
->lazy()
->default('09:00'),
TimePicker::make('end_time')
->label(__('End Time'))
->lazy()
->default('17:00'),
])
->columns(3),
->schema([
DatePicker::make('date')
->label(__('Date'))
->lazy()
->default(fn (Closure $get) => $get('../../date')
->required(),
TimePicker::make('start_time')
->label(__('Start Time'))
->lazy()
->default('09:00'),
TimePicker::make('end_time')
->label(__('End Time'))
->lazy()
->default('17:00'),
])
->columns(3),
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server