You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like the HasManyThrough relationship defines a ->one() method to convert to the HasOneThrough relation. However, none of the ofMany, latestOfMany, etc. methods exist on the HasOneThrough relation which makes the ->one() method kind of useless...
class Project extends Model
{
publicfunctionlatestDeployment(): HasOneThrough
{
// return $this->deployments()->one(); # this existsreturn$this->deployments()->one()->latestOfMany(); // fails!
}
publicfunctiondeployments(): HasManyThrough
{
return$this->hasManyThrough(Deployment::class, Environment::class);
}
}
This discussion was converted from issue #54715 on February 19, 2025 22:01.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Laravel Version
11.x
PHP Version
8.4
Database Driver & Version
Postgres
Description
Hello!
It looks like the
HasManyThrough
relationship defines a->one()
method to convert to theHasOneThrough
relation. However, none of theofMany
,latestOfMany
, etc. methods exist on theHasOneThrough
relation which makes the->one()
method kind of useless...Thanks!
Steps To Reproduce
see above
Beta Was this translation helpful? Give feedback.
All reactions