Skip to content

Fix/chained local scopes#64

Merged
benkhalife merged 3 commits into
mainfrom
fix/chained-local-scopes
Jul 1, 2026
Merged

Fix/chained local scopes#64
benkhalife merged 3 commits into
mainfrom
fix/chained-local-scopes

Conversation

@benkhalife

Copy link
Copy Markdown
Member

No description provided.

Model::__callStatic() applied a local scope directly on the raw
Builder from newQuery() and returned it as-is. Chaining anything
after that first scope (another scope, with(), etc.) hit a plain
Query\Builder that has no idea what a scope is.
__call() forwarded every unknown method straight to the raw Builder,
including scope names. A second scope in a chain — e.g.
Model::active()->adult() — failed with "Call to undefined method
Query\Builder::adult()". Now it checks for a matching scopeXxx()
on the model first.
Adds scopeAdult() to the TestUser fixture and two regression tests:
scope->scope->get() and scope->where()->orderBy()->get(). Both
reproduce the original bug before the fix and pass after it.
@benkhalife benkhalife merged commit f6e9147 into main Jul 1, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant