Skip to content

Querying relations with extra conditions in Eager Loading not working  #19488

Closed
@tisuchi

Description

@tisuchi

My regular data fetching issue has been solved by this issue.

But when I need to fetch this relationship in eager loading, it always return null.

For example-

public function allMatches()
{
     return $this->hasMany('Match', 'visitant_id')->orWhere('local_id', $this->id);
}

If I need to fetch with() method, its not working.

$team = Team::where('id', 2)->with('allMatches')->first();

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions