devaslanphp / project-management

An open source Project management tool based on Laravel and Filament
https://devaslanphp.github.io/project-management
MIT License
681 stars 188 forks source link

Add ignoreRecord attribute to unique validation rule for ticket_prefix in update of Project model. #75

Closed josefo727 closed 1 year ago

josefo727 commented 1 year ago

Added 'ignoreRecord' attribute to the 'unique' validation rule for 'ticket_prefix' when updating a project.

Currently in the file app/Filament/Resources/ProjectResource.php there is a unique validation rule

->unique(Project::class, column: 'ticket_prefix')

that prevents updating a Project because the prefix matches one in the database. The solution is to ignore the Project itself for this rule.

->unique(Project::class, column: 'ticket_prefix', ignoreRecord: true)

This solves the issue. I tried to create a branch with the solution to create a PR, but I do not have the necessary permissions to do so. Therefore, I am presenting the problem and the solution to you.

Thank you very much.

mihaisolomon commented 1 year ago

Resolved on this PR: https://github.com/devaslanphp/project-management/pull/76