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

79771PHP

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 1mo ago

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 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

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://www.gravatar.com/avatar/8fca6b45e31adb150bea10dccab85b036aa6a8f9cf4675c64a6124445757d89d?d=identicon)[adideas](/maintainers/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

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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