PHPackages                             abather/relation-components - 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. abather/relation-components

ActiveLibrary

abather/relation-components
===========================

column and entry for relations

v0.1(1mo ago)11↑2900%MITPHPPHP ^8.2

Since Mar 29Pushed 1mo agoCompare

[ Source](https://github.com/Abather/relation-components)[ Packagist](https://packagist.org/packages/abather/relation-components)[ Docs](https://github.com/abather/relation-components)[ RSS](/packages/abather-relation-components/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Relation Components
===================

[](#relation-components)

[![Relation Components](https://camo.githubusercontent.com/610923ba9dc6b0c65beccf15629202237f6b2ea0cd63938001e55999def541e1/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f52656c6174696f6e253230436f6d706f6e656e74732e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6162617468657225324672656c6174696f6e2d636f6d706f6e656e7473267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d52656c6174696f6e2b25323242656c6f6e6773546f2532432b4d6f727068546f2532322b54657874436f6c756d6e2b616e642b54657874456e747279266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667)](https://camo.githubusercontent.com/610923ba9dc6b0c65beccf15629202237f6b2ea0cd63938001e55999def541e1/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f52656c6174696f6e253230436f6d706f6e656e74732e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6162617468657225324672656c6174696f6e2d636f6d706f6e656e7473267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d52656c6174696f6e2b25323242656c6f6e6773546f2532432b4d6f727068546f2532322b54657874436f6c756d6e2b616e642b54657874456e747279266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667)

[![Latest Version on Packagist](https://camo.githubusercontent.com/6ec6e9ff6d415c2d0a09cfc689b99eb01ab5c9beb4c745afde707a3a7472d191/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616261746865722f72656c6174696f6e2d636f6d706f6e656e74732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/abather/relation-components)[![Total Downloads](https://camo.githubusercontent.com/84426968bee2495e329c55d30c1c4ee312fb17c15281dafcf84e111a1d9e88a5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616261746865722f72656c6174696f6e2d636f6d706f6e656e74732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/abather/relation-components)

Filament table columns and infolist entries for `belongsTo` and `morphTo` relationships.

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

[](#installation)

```
composer require abather/relation-components
```

Usage
-----

[](#usage)

### Table Column

[](#table-column)

```
use Abather\RelationComponents\Tables\Columns\RelationColumn;
```

### Infolist Entry

[](#infolist-entry)

```
use Abather\RelationComponents\Infolists\Components\RelationEntry;
```

---

### `belongsTo`

[](#belongsto)

Displays the related record's title with a link to its resource page.

```
RelationColumn::belongsTo(UserResource::class)
```

All parameters are optional except `$resource`:

```
RelationColumn::belongsTo(
    resource:       UserResource::class,
    relation:       'user',         // auto-derived from model class name
    titleAttribute: 'name',         // auto-derived from resource configuration
    label:          'User',         // auto-derived from resource model label
    page:           'view',         // default: 'view'
    withIcon:       true,           // default: true
)
```

---

### `morphTo`

[](#morphto)

Displays a polymorphic related record with a link to its resource page.

```
RelationColumn::morphTo(
    relation: 'subject',
    types: [
        Farm::class => FarmResource::class,
        Plot::class => PlotResource::class,
    ],
)
```

> **N+1 warning:** eager-load the relation to avoid per-row queries.
>
> ```
> // In your resource:
> public static function getEloquentQuery(): Builder
> {
>     return parent::getEloquentQuery()->with('subject');
> }
> ```

---

### Customization

[](#customization)

Both methods return a standard `TextColumn` / `TextEntry` instance, so any method from those classes can be chained after to override the defaults:

```
RelationColumn::belongsTo(UserResource::class)
    ->color('success')
    ->icon('heroicon-o-user')
    ->openUrlInNewTab(false)
    ->label('Owner')
```

```
RelationColumn::morphTo('subject', [
    Farm::class => FarmResource::class,
    Plot::class => PlotResource::class,
])->color('warning')
  ->icon(null)
```

---

Both methods work identically on `RelationEntry` for infolists.

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance90

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

46d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2d032b178010eeffd089ecd6f75934079dc36d2d41328827f1d19c729572cbeb?d=identicon)[Abather](/maintainers/Abather)

---

Top Contributors

[![Abather](https://avatars.githubusercontent.com/u/18185658?v=4)](https://github.com/Abather "Abather (2 commits)")

---

Tags

laravelrelationfilamentmorphTobelongsTotextColumnTextEntry

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/abather-relation-components/health.svg)

```
[![Health](https://phpackages.com/badges/abather-relation-components/health.svg)](https://phpackages.com/packages/abather-relation-components)
```

###  Alternatives

[guava/filament-modal-relation-managers

Allows you to embed relation managers inside filament modals.

7565.0k4](/packages/guava-filament-modal-relation-managers)[filafly/brisk

A simple, friendly theme for Filament.

2211.9k1](/packages/filafly-brisk)[tapp/filament-webhook-client

Add a Filament resource and a policy for Spatie Webhook client

1120.2k](/packages/tapp-filament-webhook-client)[jeffersongoncalves/filament-topbar

A simple yet effective Filament plugin that automatically adds a customized topbar to your Filament admin panel. This plugin enhances your Filament panel's user experience by replacing the default topbar component with an improved version that displays navigation and user interface elements in strategic locations.

171.2k](/packages/jeffersongoncalves-filament-topbar)[a2insights/filament-saas

Filament Saas for A2Insights

161.1k](/packages/a2insights-filament-saas)

PHPackages © 2026

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