Text Input Column Validation Not Working

Hi,

I am trying to add a rule (validation check ) to the date text input column rendered in table builder but for some reason it is not working
also is there any way i can access the record in the function because unable to do that as well; it gives the input state

Code:
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')),
Was this page helpful?