PHPackages                             scops/nova-belongs-to-dependency - 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. scops/nova-belongs-to-dependency

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

scops/nova-belongs-to-dependency
================================

Extended Laravel Nova BelongsTo field that can depend on other fields

2177Vue

Since May 27Pushed 4y ago1 watchersCompare

[ Source](https://github.com/scops/nova-belongs-to-dependency)[ Packagist](https://packagist.org/packages/scops/nova-belongs-to-dependency)[ RSS](/packages/scops-nova-belongs-to-dependency/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

BelongsTo field with dependency support for Nova
================================================

[](#belongsto-field-with-dependency-support-for-nova)

This package is an extension of Laravel Nova's existing BelongsTo field and Vue components.

Originally created by manmohanjit, the original package was abandoned. Then followed by webparking/nova-belongs-to-dependency, but I corrected some issues with large recordsets and addedd support for searchable fields.

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

[](#installation)

You can install this package on a Laravel app that uses [Nova](https://nova.laravel.com) via composer:

```
composer require scops/nova-belongs-to-dependency
```

Usage
-----

[](#usage)

The following will list categories with `type_id` equal to the value set in the first BelongsTo field.

```
use Scops\BelongsToDependency\BelongsToDependency;
...
return [
    ...
    BelongsTo::make('Type'),

    BelongsToDependency::make('User')
        ->dependsOn('type', 'type_id'),
    ...
];
```

Look at the [example](#example) below for other use cases.

Example
-------

[](#example)

Database Structure

- Type (id, name)
- Posts (id, type\_id, category\_id, title, body)
- Category (id, type\_id, title)

We should only be able to assign categories to posts that belong to the same type.

This is how you would achieve it on the Nova category resource:

```
use Scops\BelongsToDependency\BelongsToDependency;
...
return [
    ...
    BelongsTo::make('Type'),

    BelongsToDependency::make('User')
        ->dependsOn('type', 'type_id'),
    ...
];
```

This would work if you used a text/enum `type` field too.

```
use Scops\BelongsToDependency\BelongsToDependency;
...
return [
    ...
    Select::make('Type')->options([
        'post' => 'Post',
        'page' => 'Page',
    ])>displayUsingLabels(),

    BelongsToDependency::make('User')
        ->dependsOn('type', 'type'),
    ...
];
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

-
-
- [nova-belongsto-depend](https://github.com/orlyapps/nova-belongsto-depend) (alternative)
- [nova-dependency-container](https://github.com/epartment/nova-dependency-container)

This tool extends the base Laravel Nova BelongsTo field and is inspired by Nova Dependency Container.

License
-------

[](#license)

The MIT License (MIT). Please see License File for more information.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

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/4b1037674c3d1d30c486f1943da9b37583fdb035751c3d25feec79181ee9d9f0?d=identicon)[scops07](/maintainers/scops07)

---

Top Contributors

[![manmohanjit](https://avatars.githubusercontent.com/u/7972390?v=4)](https://github.com/manmohanjit "manmohanjit (13 commits)")[![scops](https://avatars.githubusercontent.com/u/2014109?v=4)](https://github.com/scops "scops (8 commits)")[![RVxLab](https://avatars.githubusercontent.com/u/46111684?v=4)](https://github.com/RVxLab "RVxLab (4 commits)")[![alberto-bottarini](https://avatars.githubusercontent.com/u/1442934?v=4)](https://github.com/alberto-bottarini "alberto-bottarini (1 commits)")[![matteobreschig](https://avatars.githubusercontent.com/u/69394134?v=4)](https://github.com/matteobreschig "matteobreschig (1 commits)")

### Embed Badge

![Health badge](/badges/scops-nova-belongs-to-dependency/health.svg)

```
[![Health](https://phpackages.com/badges/scops-nova-belongs-to-dependency/health.svg)](https://phpackages.com/packages/scops-nova-belongs-to-dependency)
```

###  Alternatives

[dmind/cookieman

Provides a user consent popup. It asks for approval to include tracking objects (cookies, images or any HTML) and includes the objects when consented. It also removes cookies after the consent has been revoked.

39190.5k](/packages/dmind-cookieman)

PHPackages © 2026

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