PHPackages                             rumeau/belongsto-depend - 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. rumeau/belongsto-depend

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

rumeau/belongsto-depend
=======================

A Laravel Nova field.

1674[1 issues](https://github.com/rumeau/belongsto-depend/issues)Vue

Since Apr 21Pushed 6y ago1 watchersCompare

[ Source](https://github.com/rumeau/belongsto-depend)[ Packagist](https://packagist.org/packages/rumeau/belongsto-depend)[ RSS](/packages/rumeau-belongsto-depend/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

A Laravel Nova Field for dependant fields
=========================================

[](#a-laravel-nova-field-for-dependant-fields)

This field is based on BelongsTo element and the idea from orlyapps/nova-belongsto-depend which served me as a base/idea to create my first custom field as i had problems implementing it on Laravel Nova 3

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

[](#installation)

You should be able to install this package via composer:

```
composer require rumeau/belongsto-depend
```

No additional installation instructions are required

Usage
-----

[](#usage)

Once installed, you are ready to use the field on your Nova Resources

```
// in app/Nova/ExampleResource.php
use Rumeau\BelongstoDepend\BelongstoDepend;
use App\Nova\Category;
use App\Nova\Subcategory;

// ...

public function fields()
{
    return [
        // ...
        BelongstoDepend::make(__('Category'), 'category', Category::class),

        BelongstoDepend::make(__('Subcategory'), 'subcategory', Subcategory::class)
                        ->dependsOn('category', 'parent_id'),

        // ...
    ];
}
```

`dependsOn($dependableField, $foreignKey)` method accepts two arguments:

- **$dependableField**: The field that this field depends from
- **$foreignKey**: A foreign key from which to filter the dependable field options

All BelongsTo core field options are available.

Finally in order to filter the dependable options you can use the core method from the resource `relatable()` in order to filter the query.

Final notes
-----------

[](#final-notes)

This is a work in progress as it may present some errors. So use it at your own risk.

Fork and contribute if you believe it is useful.

Thanks.

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity34

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/e9383119b547d48e82ea60da76a4b7c85df18e734520ec6f1491b1d6206659a5?d=identicon)[rumeau](/maintainers/rumeau)

---

Top Contributors

[![rumeau](https://avatars.githubusercontent.com/u/2340790?v=4)](https://github.com/rumeau "rumeau (1 commits)")

### Embed Badge

![Health badge](/badges/rumeau-belongsto-depend/health.svg)

```
[![Health](https://phpackages.com/badges/rumeau-belongsto-depend/health.svg)](https://phpackages.com/packages/rumeau-belongsto-depend)
```

###  Alternatives

[dantleech/glob-finder

Library offering object location from hierarchrical persistent storage systems using globs

551.4M3](/packages/dantleech-glob-finder)[jbzoo/mermaid-php

Generate diagrams and flowcharts with the help of the mermaid script language

471.1M6](/packages/jbzoo-mermaid-php)

PHPackages © 2026

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