NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist
Packagist, #1161 most downloaded on Packagist
Laravel Eloquent BelongsToThrough relationships
Latest stable
v2.16.4
Last release 8 months ago
28 Feb 2026
Release timing varies
gaps range from 3 weeks to 12 months
Most releases are documented
notes for 24 of 39 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
39 releases · first in 2015
Drag across the ruler to compare, or tap a release to open it.
Find BelongsToThrough relationships by return type by @staudenmeir in https://github.com/staudenmeir/belongs-to-through/pull/114
Full Changelog: https://github.com/staudenmeir/belongs-to-through/compare/v2.16.3...v2.16.4
Upgrade to PHPStan 2 by @staudenmeir in https://github.com/staudenmeir/belongs-to-through/pull/107
Full Changelog: https://github.com/staudenmeir/belongs-to-through/compare/v2.16.2...v2.16.3
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Fix docblock in BelongsToThrough by @szepeviktor in https://github.com/staudenmeir/belongs-to-through/pull/106
Full Changelog: https://github.com/staudenmeir/belongs-to-through/compare/v2.16.1...v2.16.2
Relation generics and PHPStan lvl 9 by @SanderMuller in https://github.com/staudenmeir/belongs-to-through/pull/101
Full Changelog: https://github.com/staudenmeir/belongs-to-through/compare/v2.16...v2.16.1
## What's Changed * Improve IDE helper model hook Full Changelog: https://github.com/staudenmeir/belongs-to-through/compare/v2.15...v2.15.1
Full Changelog: https://github.com/staudenmeir/belongs-to-through/compare/v2.15...v2.15.1
Make withTrashed() work with whereHas()
withTrashed() work with whereHas() (#68)- Add getThroughParents() method
getThroughParents() methodNothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Fixes existence queries with prefix.
SoftDeletes.Fixes count and existence queries on Laravel 5.0–5.3.
Fixes count and existence queries on Laravel 5.0–5.3.
Nothing published for this version
BelongsToThrough with custom ForeignKey
Match relation changes in 5.4 (#22 by @YordiLorenzo)
See CHANGELOG.
See CHANGELOG.
Nothing published for this version
Fixed issue with eager loading.
Bug fixes:
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Supports withTrashed() on intermediate models (#35).
Supports withTrashed() on intermediate models (#35).
Fixes parent model with SoftDeletes (#31).
Fixes parent model with SoftDeletes (#31).
Included support for non-conventional foreign key column names.
Test PHP 8.5 by @staudenmeir in https://github.com/staudenmeir/belongs-to-through/pull/117
Full Changelog: https://github.com/staudenmeir/belongs-to-through/compare/v2.17...v2.18
Support Laravel 12 by @staudenmeir in https://github.com/staudenmeir/belongs-to-through/pull/113
Full Changelog: https://github.com/staudenmeir/belongs-to-through/compare/v2.16.4...v2.17
## What's Changed * Support Laravel 11 Full Changelog: https://github.com/staudenmeir/belongs-to-through/compare/v2.15.1...v2.16
Full Changelog: https://github.com/staudenmeir/belongs-to-through/compare/v2.15.1...v2.16
## What's Changed * Add IDE helper model hook Full Changelog: https://github.com/staudenmeir/belongs-to-through/compare/v2.14...v2.15
Full Changelog: https://github.com/staudenmeir/belongs-to-through/compare/v2.14...v2.15
Allow customizing through relations local keys by @muhammedkamel in https://github.com/staudenmeir/belongs-to-through/pull/89
Full Changelog: https://github.com/staudenmeir/belongs-to-through/compare/v2.13...v2.14
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Prefixed keys allowed in lowest level of deep BelongsToThrough relation.
Changes:
Nothing published for this version
BelongsToThrough relation with more than one through models.
Consider a blog application. In this app, a country can have many users and a user can have many articles. So, hasManyThrough provides easy way to acc
Consider a blog application. In this app, a country can have many users and a user can have many articles. So, hasManyThrough provides easy way to access articles from a country.
class Country extends Model {
public function articles () {
return $this->hasManyThrough(Article::class, User::class);
}
}
If we are accessing the country of the article, then we have to use $article->user->country.
Class Article extends Model {
public function country() {
return $this->belongsToThrough(Country::class, User::class);
}
}
Now, the magic: $article->country
One column per quarter.