Replies: 1 comment
-
It's not a bad idea, similar to something I was thinking the other day. $city->streets()->whereKey($street->id)->exists() Would be cool if you could do $city->streets()->contains($street->id); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Lets say, we have models
City
andStreet
withhasMany
andbelongsTo
relationships.If we need to find the city that contains the street, we write:
But it may be simplified that way:
Or even:
Framework can do this work.
What do you think about this feature?
(Of course, the feature is also applicable to
whereHasMorph
)Beta Was this translation helpful? Give feedback.
All reactions