Commit for this lesson: https://github.com/LaravelDaily/Laravel-Filament-Admin-Course/commit/6f756c86bc689e5bc5fd45f47500842f10c1bafa
Commit for this lesson: https://github.com/LaravelDaily/Laravel-Filament-Admin-Course/commit/6f756c86bc689e5bc5fd45f47500842f10c1bafa
I have found a problem with the ->unique() validation.
Everything is fine when trying to create a new one, but if I try to edit, make no changes at all to that field with the unique validation (or even no changes in any fields at all), and try to save changes, you get the error of
The code has already been taken.
Any ideas of how to solve this for the edit form in Filament, please?
Tks.
@AlbertLens docs have unique rule with ignorable link to docs
Tks very much. I had missed that "little" part in the official docs.
Now, with ->unique(ignoreRecord: true) it is working perfectly.
Thanks once more.
As part of my follow up of the course, I tried to implement a zip code validation that included different validations depending on the country of the address. And I found that the way Filament passes data to validation rules is different depending on where the validation is being used from.
In case someone is interested, I created this discussion with more details: https://github.com/filamentphp/filament/discussions/6521.