PHPackages                             adideas/laravel-get-relationship-eloquent-model - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. adideas/laravel-get-relationship-eloquent-model

ActiveLibrary[Database &amp; ORM](/categories/database)

adideas/laravel-get-relationship-eloquent-model
===============================================

Laravel get relationship eloquent models

71.3k1PHP

Since May 3Pushed 5y ago2 watchersCompare

[ Source](https://github.com/adideas/laravel-get-relationship-eloquent-model)[ Packagist](https://packagist.org/packages/adideas/laravel-get-relationship-eloquent-model)[ RSS](/packages/adideas-laravel-get-relationship-eloquent-model/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel get relationship eloquent models
========================================

[](#laravel-get-relationship-eloquent-models)

Имея одну или множество моделей Eloquent, благодоря этому пакету можно получить все ее отношения и их тип во время выполнения!
------------------------------------------------------------------------------------------------------------------------------

[](#имея-одну-или-множество-моделей-eloquent-благодоря-этому-пакету-можно-получить-все-ее-отношения-и-их-тип-во-время-выполнения)

### Иногда это действительно необходимо например для системы удалений где есть связи с другими сущностями. Например нужно удалить модель и динамически узнать что нужно еще удалить. Для этого вам не нужно знать названия методов в модели. И уж тем более подстраивать их названия не под архитектуру а под что то другое.

[](#иногда-это-действительно-необходимо-например-для-системы-удалений-где-есть-связи-с-другими-сущностями-например-нужно-удалить-модель-и-динамически-узнать-что-нужно-еще-удалить-для-этого-вам-не-нужно-знать-названия-методов-в-модели-и-уж-тем-более-подстраивать-их-названия-не-под-архитектуру-а-под-что-то-другое)

### Этот пакет создан для других разработчиков, которым необходимо знать об отношениях.

[](#этот-пакет-создан-для-других-разработчиков-которым-необходимо-знать-об-отношениях)

### Laravel как получить все отношения

[](#laravel-как-получить-все-отношения)

### как получить названия всех связей

[](#как-получить-названия-всех-связей)

### getRelations()

[](#getrelations)

\--

Having one or many Eloquent models, thanks to this package, you can get all of its relationships and their type at runtime
--------------------------------------------------------------------------------------------------------------------------

[](#having-one-or-many-eloquent-models-thanks-to-this-package-you-can-get-all-of-its-relationships-and-their-type-at-runtime)

### Sometimes this is really necessary, for example, for a deletion system where there are connections with other entities. For example, you need to delete a model and dynamically find out what else needs to be deleted. You don't need to know the names of the methods in the model to do this. And even more so to adjust their names not for architecture, but for something else.

[](#sometimes-this-is-really-necessary-for-example-for-a-deletion-system-where-there-are-connections-with-other-entities-for-example-you-need-to-delete-a-model-and-dynamically-find-out-what-else-needs-to-be-deleted-you-dont-need-to-know-the-names-of-the-methods-in-the-model-to-do-this-and-even-more-so-to-adjust-their-names-not-for-architecture-but-for-something-else)

### This package is for other developers who need to know about relationships.

[](#this-package-is-for-other-developers-who-need-to-know-about-relationships)

---

**View (get) all links (links) of any eloquent Laravel models**

- [Installation](#installation)
- [Usage](#usage)
- [Config](#config)

Installation
------------

[](#installation)

Require this package with composer using the following command:

```
composer require adideas/laravel-get-relationship-eloquent-model
```

Put star :) please

Usage
-----

[](#usage)

```
use App\Http\Controllers\Controller;
use Adideas\RelationFinder\Relations;

class MyController extends Controller
{

    public function show(MyModel $myModel, Relations $relations)
    {
        $relations->where('name', 'myRelationFunction'); // return collect

        dd($relations); // return collect

        Relations::relations($myModel)->where('name', 'myRelationFunction'); // return collect

    }

}
```

OR

```
use Adideas\RelationFinder\RelationsFinder;

class MyModel extends Model
{
    use RelationsFinder;

}
```

```
use App\Http\Controllers\Controller;

class MyController extends Controller
{

    public function show(MyModel $myModel)
    {
        MyModel::relations()->where('name', 'myRelationFunction'); // return collect

        // or

        $myModel->relations()->where('name', 'myRelationFunction'); // return collect
    }

}
```

Config
------

[](#config)

If you want to see all models! Install the key.

```
class MyModel extends Model
{
    const WITH_VENDOR_RELATION = true;

    // or

    public $withVendorRelation = true;
}
```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/50667072?v=4)[Alexey Vlasov](/maintainers/adideas)[@adideas](https://github.com/adideas)

---

Top Contributors

[![adideas](https://avatars.githubusercontent.com/u/50667072?v=4)](https://github.com/adideas "adideas (6 commits)")

### Embed Badge

![Health badge](/badges/adideas-laravel-get-relationship-eloquent-model/health.svg)

```
[![Health](https://phpackages.com/badges/adideas-laravel-get-relationship-eloquent-model/health.svg)](https://phpackages.com/packages/adideas-laravel-get-relationship-eloquent-model)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M118](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[pgvector/pgvector

pgvector support for PHP

198741.5k12](/packages/pgvector-pgvector)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
