Repository navigation
[13.x] Compare fluent database rule where() values literally - #62425
Merged
Merged
Conversation
Amp-Thread-ID: https://ampcode.com/threads/T-3d89b274-cdac-43b7-82a3-2c5f8fd1bbde Co-authored-by: Pushpak Chhajed <pushpak@laravel.com>
pushpak1300
marked this pull request as ready for review
November 11, 2026 13:22
SanderMuller
added a commit
to SanderMuller/laravel-fluent-validation
that referenced
this pull request
Nov 13, 2026
laravel/framework#62425 and #62426 (not yet tagged) store the where clauses of a database rule with an operator and compare the values literally. The batch query read only the old shape, so it dropped whereNull() and withoutTrashed() conditions, and soft-deleted rows passed exists (#30). The batched results were also keyed by table and column only. Rules with a different where clause, connection or ignored id, plain fields on the same column, and rules added in withValidator() read each other's results. Invalid input could pass and valid input could fail. The batch also compared the stored values to the input in PHP. On a case-insensitive collation or an integer column, the result differed from Laravel. For example, on MySQL, unique let ALICE@example.com pass when alice@example.com existed. - Read both where shapes. - Key each batched result by the exact presence-verifier call that Laravel makes. Use the real verifier for any other call, for any value the batch did not query, and for array values (getMultiCount()). - Let the database compare each value, so the batch matches the collation and type rules that Laravel's own query uses. - Run one query for fields that run the same query, in any where order. - Keep a rule per item when Laravel passes its conditions as closures. Fixes #30 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
binaryfire
added a commit
to hypervel/components
that referenced
this pull request
Nov 15, 2026
Honor queryCallbacks overrides and avoid reconstructing conditions discarded by custom database rules. Compare native stored conditions directly so equivalent Data rules can share validation without losing callback identity or repeated predicates. Keep boolean JSON candidates native in scalar presence checks and group boolean alternatives in array checks. Ordinary candidates retain their existing query and binding behavior. Corrects adaptations of laravel/framework#62425, #62447, #62442 and #62459 at c980cb5827c6512c12ac44493d172a593b41299a. Parser, Data and affected SQLite, PostgreSQL, MySQL and MariaDB validation tests pass, as do full static analysis and formatting.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fluent
Rule::exists()andRule::unique()rules write theirwhere()conditions into the string rule format, and the validator parses them back. Some values do not survive that round trip. For example,->where('status', 'NULL')runswhereNull('status'), and->where('code', '!abc')runscode != 'abc'.The validator now reads the conditions from the rule object, so
where()always compares the value literally.whereNull(),whereNotNull()andwhereNot()work as before, and(string) $ruledoes not change.Note
A custom presence verifier receives a closure in
$extrafor awhere()value ofNULLorNOT_NULL, or one that starts with!. Other values arrive as before.