Adds Validation Rule format for use with Orbit #38
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
After adding this package to an existing Laravel project by following the description in the Readme file, I started to test out the Laravel project functionality and ended up seeing errors when trying to save Models.
After some investigation, I found out that the custom Form Requests I have created to validate my form submissions were using rules that require verification of existence or uniqueness of an entry into a database table. That was done using the builtin Laravel Validation Rules
exists
andunique
.Solution
Realising that this package heavily relies in the Model itself to act, I've decided to change the rule format to the alternative Eloquent (Model) format, which uses the Eloquent fully qualified name (FQN) instead of the database table name. Doing so, we force Laravel to directly use the Model which uses Orbit behind the scenes instead of going to the database and search for the table name and make the checks.
With this change, this specific behaviour is now visible for others that may face the same situation.
Notes
Please, feel free to amend the text I've added to the Readme and test the solution yourself before accepting this PR.