Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance Custom Rules: Introduce translatableExists and translatableUnique for Validating Translatable Attributes #406

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

amjadbanimattar
Copy link

Description:
Incorporating unique and existence validation for translatable attributes can be crucial for many projects. The current Laravel validation doesn't inherently support this functionality, prompting the need for custom solutions.

This pull request introduces two custom validation rules, translatableExists, and translatableUnique, tailored specifically for validating translatable attributes. With these additions, developers gain the ability to ensure data integrity and uniqueness within multilingual datasets effortlessly.

Changes:
Added translatableExists rule to validate the existence of translatable attributes.
Introduced translatableUnique rule for enforcing uniqueness constraints on translatable fields.

Purpose:
This enhancement empowers developers to perform comprehensive validation on translatable attributes, enhancing data validation capabilities within multilingual contexts. By providing these custom rules, we aim to streamline development workflows and promote best practices in data validation.

Benefits:
Facilitates validation of translatable attributes for existence and uniqueness.
Enhances data integrity and consistency within multilingual datasets.
Provides developers with versatile tools for enforcing validation rules tailored to translatable fields.

Usage:
Developers can now utilize the translatableExists and translatableUnique rules in Laravel validation logic to ensure data integrity and uniqueness across multilingual attributes effortlessly.

Copy link
Member

@Gummibeer Gummibeer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far looking okay - in addition to the requested changes please run the composer fix command locally to fix all the style changes.

README.md Outdated Show resolved Hide resolved
src/Translatable/Validation/Rules/TranslatableExists.php Outdated Show resolved Hide resolved
src/Translatable/Validation/Rules/TranslatableExists.php Outdated Show resolved Hide resolved
src/Translatable/Validation/Rules/TranslatableExists.php Outdated Show resolved Hide resolved
src/Translatable/Validation/Rules/TranslatableExists.php Outdated Show resolved Hide resolved
src/Translatable/Validation/Rules/TranslatableUnique.php Outdated Show resolved Hide resolved
- Fix PHPDocs, and Code Style
@amjadbanimattar
Copy link
Author

So far looking okay - in addition to the requested changes please run the composer fix command locally to fix all the style changes.

All request changes fixed, and pushed.

.gitignore Outdated
@@ -4,3 +4,4 @@
/.phpunit.cache
/build/
/coverage.clover
.history
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go into your global gitignore as it's not related to the project but your local environment.

https://sebastiandedeyne.com/setting-up-a-global-gitignore-file/

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

@Gummibeer
Copy link
Member

Tests seem to fail for Laravel 9

… InvokableRule interface instead of the new one introduced in Laravel 10. Future updates will accommodate the removal of Laravel 9 support.
@amjadbanimattar
Copy link
Author

Tests seem to fail for Laravel 9

Apologies, @Gummibeer, I hadn't realized the compatibility issue with Laravel 9.

The code has been updated to accommodate Laravel 9, but it will require further refinement once Laravel 9 is no longer supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants