Skip to content

Dynamic where{Column} methods not resolved on relation chains #647

@alies-dev

Description

@alies-dev

Problem

Laravel's __call magic on Builder supports dynamic where{Column} methods (e.g., whereEmail('foo')where('email', '=', 'foo')). These are not resolved when called through a relation.

// ❌ UndefinedMagicMethod
$user->posts()->whereTitle('foo')->get();
$user->posts()->whereSlug('bar')->first();

// ✅ Equivalent explicit call works
$user->posts()->where('title', 'foo')->get();

Priority

Low — explicit where() is the more common pattern, but dynamic where{Column} is used in some codebases.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions