Skip to content

Conversation

@staudenmeir
Copy link
Contributor

HasManyThrough::one() doesn't actually work because it duplicates the JOIN clause and breaks the query:

select "articles".*, "users"."team_id" as "laravel_through_key"
from "articles"
         inner join "users" on "users"."id" = "articles"."user_id"
         inner join "users" on "users"."id" = "articles"."user_id"
where "users"."team_id" = 1
order by "created_at" desc
limit 1

We need to remove it before HasOneThrough adds it again.

@taylorotwell taylorotwell merged commit 57d6188 into laravel:11.x Oct 12, 2024
33 checks passed
@staudenmeir staudenmeir deleted the has-many-through-one branch October 12, 2024 16:30
timacdonald pushed a commit to timacdonald/framework that referenced this pull request Oct 15, 2024
macropay-solutions pushed a commit to macropay-solutions/maravel-framework that referenced this pull request Jul 6, 2025
macropay-solutions pushed a commit to macropay-solutions/maravel-framework that referenced this pull request Jul 6, 2025
macropay-solutions pushed a commit to macropay-solutions/maravel-framework that referenced this pull request Jul 6, 2025
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.

2 participants