TextInputColumn::make('deadline')
->type('date')
->rules([
fn ($record, $component) => function ($attributes, $value, $fail) use ($record) {
if ($value < now()->format('Y-m-d')) {
$fail('Closing date must be greater than or equal to ' . now()->format('Y-m-d'));
} elseif ($value < $record->deadline?->format('Y-m-d')) {
$fail("Closing date must be greater than or equal to last saved date ({$record->deadline->format('Y-m-d')})");
}
},
'nullable'], )
->getStateUsing(fn ($record) => $record->deadline?->format('Y-m-d')),
TextInputColumn::make('deadline')
->type('date')
->rules([
fn ($record, $component) => function ($attributes, $value, $fail) use ($record) {
if ($value < now()->format('Y-m-d')) {
$fail('Closing date must be greater than or equal to ' . now()->format('Y-m-d'));
} elseif ($value < $record->deadline?->format('Y-m-d')) {
$fail("Closing date must be greater than or equal to last saved date ({$record->deadline->format('Y-m-d')})");
}
},
'nullable'], )
->getStateUsing(fn ($record) => $record->deadline?->format('Y-m-d')),