PHPackages                             digital-creative/custom-relationship-field - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. digital-creative/custom-relationship-field

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

digital-creative/custom-relationship-field
==========================================

Emulate HasMany relationship without having a real relationship set between resources

v1.1.3(1y ago)33200.0k—1.2%6[3 issues](https://github.com/dcasia/custom-relationship-field/issues)MITPHPPHP &gt;=8.0

Since Jan 22Pushed 1y ago4 watchersCompare

[ Source](https://github.com/dcasia/custom-relationship-field)[ Packagist](https://packagist.org/packages/digital-creative/custom-relationship-field)[ Docs](https://github.com/dcasia/custom-relationship-field)[ GitHub Sponsors](https://github.com/milewski)[ RSS](/packages/digital-creative-custom-relationship-field/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (1)Versions (13)Used By (0)

Custom Relationship Field
=========================

[](#custom-relationship-field)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f8c2823dd8ec64089f3e16fa8104836aafa61ef3c637cf48a1414a8d88115ed1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6469676974616c2d63726561746976652f637573746f6d2d72656c6174696f6e736869702d6669656c64)](https://packagist.org/packages/digital-creative/custom-relationship-field)[![Total Downloads](https://camo.githubusercontent.com/ab832e864809e789f0189c769b725984ff9bbb7a4eced986498d77e277b0482b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6469676974616c2d63726561746976652f637573746f6d2d72656c6174696f6e736869702d6669656c64)](https://packagist.org/packages/digital-creative/custom-relationship-field)[![License](https://camo.githubusercontent.com/f4e946a931cd98d051be3727868358a2e65444afcca6374c72626b4c72b4e051/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6469676974616c2d63726561746976652f637573746f6d2d72656c6174696f6e736869702d6669656c64)](https://github.com/dcasia/custom-relationship-field/blob/main/LICENSE)

  ![Custom Relationship Field in action](https://raw.githubusercontent.com/dcasia/custom-relationship-field/main/screenshots/light.png)This field works just like as the default HasMany relationship field from nova but **without requiring a real relation** with the resource.

That means you are free to show resource `A` into the details page of resource `B` without having to create a real relation between them.

Installation
============

[](#installation)

You can install the package via composer:

```
composer require digital-creative/custom-relationship-field
```

```
use DigitalCreative\CustomRelationshipField\CustomRelationshipField;
use DigitalCreative\CustomRelationshipField\CustomRelationshipFieldTrait;

trait UserWithSimilarNameTrait
{
    public static function similarNameQuery(NovaRequest $request, Builder $query, User $model): Builder
    {
        return $query->where('last_name', $model->last_name)->whereKeyNot($model->getKey());
    }

    public function similarNameFields(NovaRequest $request): array
    {
        return [
            ID::make(),
            Text::make('First Name'),
            Text::make('Last Name'),
        ];
    }

    public function similarNameActions(NovaRequest $request): array
    {
        return [];
    }

    public function similarNameFilters(NovaRequest $request): array
    {
        return [];
    }
}

class User extends Resource
{
    use CustomRelationshipFieldTrait;
    use UserWithSimilarNameTrait;

    public function fields(NovaRequest $request): array
    {
        return [
            ...
            CustomRelationshipField::make('Users with similar name', 'similarName', User::class),
            ...
        ];
    }
}
```

⭐️ Show Your Support
--------------------

[](#️-show-your-support)

Please give a ⭐️ if this project helped you!

### Other Packages You Might Like

[](#other-packages-you-might-like)

- [Nova Dashboard](https://github.com/dcasia/nova-dashboard) - The missing dashboard for Laravel Nova!
- [Nova Welcome Card](https://github.com/dcasia/nova-welcome-card) - A configurable version of the `Help card` that comes with Nova.
- [Icon Action Toolbar](https://github.com/dcasia/icon-action-toolbar) - Replaces the default boring action menu with an inline row of icon-based actions.
- [Expandable Table Row](https://github.com/dcasia/expandable-table-row) - Provides an easy way to append extra data to each row of your resource tables.
- [Collapsible Resource Manager](https://github.com/dcasia/collapsible-resource-manager) - Provides an easy way to order and group your resources on the sidebar.
- [Resource Navigation Tab](https://github.com/dcasia/resource-navigation-tab) - Organize your resource fields into tabs.
- [Resource Navigation Link](https://github.com/dcasia/resource-navigation-link) - Create links to internal or external resources.
- [Nova Mega Filter](https://github.com/dcasia/nova-mega-filter) - Display all your filters in a card instead of a tiny dropdown!
- [Nova Pill Filter](https://github.com/dcasia/nova-pill-filter) - A Laravel Nova filter that renders into clickable pills.
- [Nova Slider Filter](https://github.com/dcasia/nova-slider-filter) - A Laravel Nova filter for picking range between a min/max value.
- [Nova Range Input Filter](https://github.com/dcasia/nova-range-input-filter) - A Laravel Nova range input filter.
- [Nova FilePond](https://github.com/dcasia/nova-filepond) - A Nova field for uploading File, Image and Video using Filepond.
- [Custom Relationship Field](https://github.com/dcasia/custom-relationship-field) - Emulate HasMany relationship without having a real relationship set between resources.
- [Column Toggler](https://github.com/dcasia/column-toggler) - A Laravel Nova package that allows you to hide/show columns in the index view.
- [Batch Edit Toolbar](https://github.com/dcasia/batch-edit-toolbar) - Allows you to update a single column of a resource all at once directly from the index page.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://raw.githubusercontent.com/dcasia/custom-relationship-field/master/LICENSE) for more information.

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity46

Moderate usage in the ecosystem

Community17

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 82.1% 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

Every ~149 days

Total

12

Last Release

670d ago

Major Versions

v0.1.6 → v1.02022-11-15

PHP version history (2 changes)v0.1.0PHP &gt;=7.1.0

v1.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/e4a85b779289ce63c67af70941a545331f3e362a4b58330495cc7e77250e5401?d=identicon)[milewski](/maintainers/milewski)

---

Top Contributors

[![milewski](https://avatars.githubusercontent.com/u/2874967?v=4)](https://github.com/milewski "milewski (23 commits)")[![littlemiaor](https://avatars.githubusercontent.com/u/2921366?v=4)](https://github.com/littlemiaor "littlemiaor (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![nw-b](https://avatars.githubusercontent.com/u/1254417?v=4)](https://github.com/nw-b "nw-b (1 commits)")[![Tarpsvo](https://avatars.githubusercontent.com/u/2018660?v=4)](https://github.com/Tarpsvo "Tarpsvo (1 commits)")

---

Tags

custom-fieldlaravelnovanova4relationshiplaravelnovacustomrelationshiphas-manynova4

### Embed Badge

![Health badge](/badges/digital-creative-custom-relationship-field/health.svg)

```
[![Health](https://phpackages.com/badges/digital-creative-custom-relationship-field/health.svg)](https://phpackages.com/packages/digital-creative-custom-relationship-field)
```

###  Alternatives

[optimistdigital/nova-sortable

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag &amp; drop.

2872.1M6](/packages/optimistdigital-nova-sortable)[outl1ne/nova-sortable

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag &amp; drop.

2861.8M9](/packages/outl1ne-nova-sortable)[optimistdigital/nova-multiselect-field

A multiple select field for Laravel Nova.

3403.5M7](/packages/optimistdigital-nova-multiselect-field)[sietse85/nova-button

(Nova 4+) A Laravel Nova package for adding buttons to your resources.

37347.3k](/packages/sietse85-nova-button)[sbine/route-viewer

A Laravel Nova tool to view your registered routes.

57215.9k](/packages/sbine-route-viewer)[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

14720.0k](/packages/markwalet-nova-modal-response)

PHPackages © 2026

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