# staudenmeir/belongs-to-through

Laravel Eloquent BelongsToThrough relationships

Repository: https://github.com/staudenmeir/belongs-to-through
Canonical: https://ross.abutalabs.com/products/belongs-to-through
Language: PHP
License: MIT
License Family: permissive
Last push: 2026-02-28T16:27:05+00:00

## Health v2 (maintenance only)
Score: 72/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 69, release rhythm 60, longevity 100
- inputs: {"age_days": 4109, "days_push": 186, "days_rel": 186, "gap_med": 58, "n_releases_24m": 6}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1270, forks 97 (observed 2026-08-28T04:04:11.892385+00:00)

## What it is
A Laravel Eloquent package that adds BelongsToThrough relationships, the inverse of HasManyThrough, with support for unlimited intermediate models. It is installed via Composer and supports Laravel 5.0 through 13.x.

## Use cases
- define belongs-to-through relationships in Laravel Eloquent
- get an ancestor model through intermediate relations in Laravel
- inverse of hasManyThrough in Eloquent
- query a grandparent relation from a deeply nested model
- traverse multiple intermediate models in a Laravel relationship

## When to choose
- you need the inverse of HasManyThrough in Laravel Eloquent
- your model belongs to a distant ancestor through several intermediate models
- you need custom foreign/local keys, table aliases, or soft-delete support in through relationships

## When to avoid
- you don't use Laravel or Eloquent
- a simple belongsTo or hasManyThrough relationship suffices

## Facets
- artifact type: library
- maturity: active
- function: orm, database
- domain: web-development, backend, databases
- platform: php
- tags: eloquent, laravel-package, belongs-to-through, relationships, composer, laravel

## Member repositories
- staudenmeir/belongs-to-through (main) score 72

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:11.892385+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T05:03:28.124162+00:00, confidence not recorded.
  - readme: https://github.com/staudenmeir/belongs-to-through (fetched 2026-08-28T04:04:11.892385+00:00, sha 883947de0bd5)
- Data as of 2026-08-30T08:39:29.467469+00:00.
