F
Filament12mo ago
Anik

repeater values for previous row

Hi, I have a Repeater for time slots where slots must not overlap and each slot's start must be after the end of the previous one. Kindly help me validate the code.
public function getAvailableSlots($day)
{
return TableRepeater::make('data.' . $day)->label(ucfirst($day))->columnSpan('full')->hideLabels()->emptyLabel('No available slots.')->schema([
Forms\Components\TimePicker::make('start')
->label('Start Time')
->seconds(false)
->lazy(),
Forms\Components\TimePicker::make('end')
->label('End Time')
->seconds(false)
->lazy()
->extraInputAttributes(function (Get $get) {
return [
'min' => Carbon::parse($get('start'))->addHour()->format('H:i')
];
}),
Forms\Components\TextInput::make('rate')
->label('Rate'),
]);
}
public function getAvailableSlots($day)
{
return TableRepeater::make('data.' . $day)->label(ucfirst($day))->columnSpan('full')->hideLabels()->emptyLabel('No available slots.')->schema([
Forms\Components\TimePicker::make('start')
->label('Start Time')
->seconds(false)
->lazy(),
Forms\Components\TimePicker::make('end')
->label('End Time')
->seconds(false)
->lazy()
->extraInputAttributes(function (Get $get) {
return [
'min' => Carbon::parse($get('start'))->addHour()->format('H:i')
];
}),
Forms\Components\TextInput::make('rate')
->label('Rate'),
]);
}
I want to get the value of the previous index in the json array for validation
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server