DatePicker and unique: Format is ignored.
I have a DatePicker with the following methods:
The
published_at
field is just a date
SQL column (without time). In the form, I wanna see and save the date in Y-m-d
format, which is working.
The problem is, that the unique rule never hits, because the generated query (checked it in telescope) is the following:
5 Replies
Ok, since unique doesn't seems to work, I solved it with custom rule:
can we add ignorerecord in custom rule
why? you have complete control over what happens in your custom field
we dont need it as a core feature
i used rule this way to check unique but i can not able figure it out how to use ignoreRecord true as it is making problem while updating
function ($attribute, $value, $fail) use ($record)
then you can access $record inside the internal function
and add it to your query