Fix: External identifier validation error handling
This pull request introduces stricter validation to ensure that the external_id field for servers remains unique when updating server details, and adds a utility method for update validation rules. The changes enhance data integrity and provide clearer error handling for duplicate external IDs.
Validation Improvements:
- Added a uniqueness check for
external_idin theServersControllerupdate logic, throwing aValidationExceptionif a duplicate is found when updating a server. - Added a similar uniqueness validation for
external_idinServerFormRequest, ensuring that form requests also enforce this rule and provide user-friendly error messages.
Model Enhancements:
- Introduced a new static method
getRulesForUpdatein theServermodel to generate validation rules suitable for update operations, handling uniqueness checks and allowing for the exclusion of the current record. - Imported the
Ruleclass inServer.phpto support advanced validation rule definitions.
🔗 Linked Issue:
#5549
@KroZen-Dev instead of saying The external identifier must be unique to this server. shouldn't it say it has to be unique on the panel? its not possible to assign more than 1 to a individual server
@KroZen-Dev instead of saying
The external identifier must be unique to this server.shouldn't it say it has to be unique on the panel? its not possible to assign more than 1 to a individual server
Agreed, corrected
this should be closed @robertdrakedennis