Fix range filters, declare Laravel deps, add test suite and CI - #2
Merged
Merged
Conversation
scopeFilter dropped every _min/_max key because it checked the raw key against $fillable, so the documented range filter never ran. When the key was made fillable, rtrim($field, '_min') stripped a character set rather than the suffix, turning tax_max into the column t and max_max into an empty string. Range keys now resolve to their base column with substr() and are matched against $fillable by that column. Boolean fields are table-qualified like every other condition, and in_array() comparisons are strict. composer.json declared no Laravel packages while using Illuminate classes, pinned version 1.0.0 over the git tags, and set minimum-stability to dev.
The matrix installed illuminate/* per Laravel version but left orchestra/testbench unconstrained, so Composer could not resolve a matching testbench and every Laravel 10 and 11 job failed. Laravel 10 and 11 are both past their security-support window, so every release carries an advisory and Composer refuses to install them. Laravel 10 is dropped; Laravel 11 is kept and tested with the advisory block lifted in the workflow only.
PHP 8.1 is only reachable through Laravel 10, so illuminate/* is widened back to ^10.0 and the matrix covers 8.1 through 8.5. Testbench 8 defaults to the mysql connection, unlike 9 and 10 which default to in-memory sqlite, so every test errored with 'could not find driver' on Laravel 10. The test case now declares the sqlite connection explicitly instead of relying on the default. The CI install step also moved orchestra/testbench out of require-dev by requiring it without --dev.
Laravel 13.32.0 was released on 2026-09-15 and requires PHP ^8.3, paired with orchestra/testbench 11. The suite passes against it unchanged. The audit-block exception now names Laravel 10 and 11 explicitly instead of excluding 12, which would have lifted it for 13 as well.
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.
Two bugs made the documented range filter a no-op
scopeFilter()matched the raw filter key against$fillable, soage_min/age_maxwere droppedbefore reaching the range branch. The README's own example (
$fillable = ['name','email','is_active']with
age_min/age_maxfilters) silently returned unfiltered results.Working around it by adding
age_minto$fillablehit a second bug:rtrim($field, '_min')strips acharacter set, not a suffix.
Range keys now resolve via
substr($field, 0, -4)and are matched against$fillableby their base column.Also in this PR
composer.jsonusedIlluminate\*classes without requiring any Laravel package; addedilluminate/databaseandilluminate/support(L10/11/12)"version": "1.0.0", which overrode the git tags on Packagist"minimum-stability": "dev"— it madecomposer installfail outrightin_array()comparisons;declare(strict_types=1)and parameter/return types throughoutwhereLikesplits on the last dot, so nested relations (posts.comments.body) work; it no longerre-registers if the macro already exists
phpunit.xmlrewritten for the PHPUnit 11 schema (verbose="true"was removed in PHPUnit 10).phpunit.result.cacheandcomposer.lockTests
scopeFilterhad no test at all. Added 12 covering exact, LIKE, boolean,whereIn, null handling,non-fillable rejection, both range operators and the suffix-corruption cases; 7 for the macro including
nested relations. The 5 range tests fail on
masterand pass here.19 tests, 20 assertions, green. Rector clean.
One behaviour change to be aware of
applyFieldFilter()isprotectedand its signature changed (it now takes the resolved column andoperator). Anything overriding it needs updating — unlikely, but it is the only BC-sensitive edit.