Skip to content

Releases: staudenmeir/belongs-to-through

Version 2.2.2

29 May 07:52
Compare
Choose a tag to compare

Version 2.2.1

07 Apr 07:46
Compare
Choose a tag to compare

Version 2.2

03 Feb 14:12
Compare
Choose a tag to compare
Changes in this version:
  • Included support for non-conventional foreign key column names.

Version 2.1

10 Dec 06:28
Compare
Choose a tag to compare

Changes:

  • Prefixed keys allowed in lowest level of deep BelongsToThrough relation.

Version 2.0

17 Nov 07:12
Compare
Choose a tag to compare
  • BelongsToThrough relation with more than one through models.

Version 2.0

23 Oct 20:17
Compare
Choose a tag to compare
Version 2.0 Pre-release
Pre-release
  • Deeper relations.

Version 1.0.1

15 Jun 10:36
Compare
Choose a tag to compare

Bug fixes:

  1. Fixed issue with eager loading.

Version 1.0

06 Jun 21:35
Compare
Choose a tag to compare

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